public inbox for u-boot@lists.denx.de
 help / color / mirror / Atom feed
* [U-Boot] [PATCH] cs8900_initialize() cleanup [rev2]
@ 2010-01-21 21:16 Matthias Kaehlcke
  2010-01-21 21:27 ` Ben Warren
  0 siblings, 1 reply; 2+ messages in thread
From: Matthias Kaehlcke @ 2010-01-21 21:16 UTC (permalink / raw)
  To: u-boot

cs8900_initialize(): remove unecessary calls to free() and fix memory leak

Signed-off-by: Matthias Kaehlcke <matthias@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));
-- 
1.6.3.1

^ permalink raw reply related	[flat|nested] 2+ messages in thread

* [U-Boot] [PATCH] cs8900_initialize() cleanup [rev2]
  2010-01-21 21:16 [U-Boot] [PATCH] cs8900_initialize() cleanup [rev2] Matthias Kaehlcke
@ 2010-01-21 21:27 ` Ben Warren
  0 siblings, 0 replies; 2+ messages in thread
From: Ben Warren @ 2010-01-21 21:27 UTC (permalink / raw)
  To: u-boot

Matthias,

Matthias Kaehlcke wrote:
> cs8900_initialize(): remove unecessary calls to free() and fix memory leak
>
> Signed-off-by: Matthias Kaehlcke <matthias@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

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2010-01-21 21:27 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2010-01-21 21:16 [U-Boot] [PATCH] cs8900_initialize() cleanup [rev2] Matthias Kaehlcke
2010-01-21 21:27 ` Ben Warren

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox