[PATCH 1/2] parameter: fix memory leak

Sascha Hauer s.hauer at pengutronix.de
Fri Oct 12 04:03:10 EDT 2012


On Wed, Oct 10, 2012 at 12:42:50PM +0200, Jan Luebbe wrote:
> In __dev_add_param, the name string is allocated using strdup.
> Free it when removing the parameter.
> 
> Signed-off-by: Jan Luebbe <jlu at pengutronix.de>

Applied, thanks

Sascha

> ---
>  lib/parameter.c |    1 +
>  1 file changed, 1 insertion(+)
> 
> diff --git a/lib/parameter.c b/lib/parameter.c
> index 3ecb480..b33ad17 100644
> --- a/lib/parameter.c
> +++ b/lib/parameter.c
> @@ -224,6 +224,7 @@ void dev_remove_parameters(struct device_d *dev)
>  	list_for_each_entry_safe(p, n, &dev->parameters, list) {
>  		p->set(dev, p, NULL);
>  		list_del(&p->list);
> +		free(p->name);
>  		free(p);
>  	}
>  }
> -- 
> 1.7.10.4
> 
> 
> _______________________________________________
> barebox mailing list
> barebox at lists.infradead.org
> http://lists.infradead.org/mailman/listinfo/barebox
> 

-- 
Pengutronix e.K.                           |                             |
Industrial Linux Solutions                 | http://www.pengutronix.de/  |
Peiner Str. 6-8, 31137 Hildesheim, Germany | Phone: +49-5121-206917-0    |
Amtsgericht Hildesheim, HRA 2686           | Fax:   +49-5121-206917-5555 |



More information about the barebox mailing list