[U-Boot] [PATCH 7/8] net: emaclite: Free allocated space for device

Michal Simek monstr at monstr.eu
Fri Aug 26 14:47:22 CEST 2011


Free allocated space for device when allocating
failed for private data.

Signed-off-by: Michal Simek <monstr at monstr.eu>
---
 drivers/net/xilinx_emaclite.c |    4 +++-
 1 files changed, 3 insertions(+), 1 deletions(-)

diff --git a/drivers/net/xilinx_emaclite.c b/drivers/net/xilinx_emaclite.c
index ac6c783..e0b6ce5 100644
--- a/drivers/net/xilinx_emaclite.c
+++ b/drivers/net/xilinx_emaclite.c
@@ -356,8 +356,10 @@ int xilinx_emaclite_initialize (bd_t *bis, int base_addr)
 		return -1;
 
 	emaclite = calloc(1, sizeof(struct xemaclite));
-	if (emaclite == NULL)
+	if (emaclite == NULL) {
+		free(dev);
 		return -1;
+	}
 
 	dev->priv = emaclite;
 
-- 
1.5.5.6



More information about the U-Boot mailing list