[U-Boot] [PATCH] cs8900_initialize() cleanup [rev2]

Ben Warren biggerbadderben at gmail.com
Thu Jan 21 22:27:28 CET 2010


Matthias,

Matthias Kaehlcke wrote:
> cs8900_initialize(): remove unecessary calls to free() and fix memory leak
>
> Signed-off-by: Matthias Kaehlcke <matthias at kaehlcke.net>
> ---
>  drivers/net/cs8900.c |    3 +--
>  1 files changed, 1 insertions(+), 2 deletions(-)
>
> diff --git a/drivers/net/cs8900.c b/drivers/net/cs8900.c
> index df36004..9424fb2 100644
> --- a/drivers/net/cs8900.c
> +++ b/drivers/net/cs8900.c
> @@ -308,14 +308,13 @@ int cs8900_initialize(u8 dev_num, int base_addr)
>  
>  	dev = malloc(sizeof(*dev));
>  	if (!dev) {
> -		free(dev);
>  		return 0;
>  	}
>  	memset(dev, 0, sizeof(*dev));
>  
>  	priv = malloc(sizeof(*priv));
>  	if (!priv) {
> -		free(priv);
> +		free(dev);
>  		return 0;
>  	}
>  	memset(priv, 0, sizeof(*priv));
>   
Applied to net repo.

thanks,
Ben


More information about the U-Boot mailing list