[PATCH 01/11] bootm: fix possible memory leak

Sascha Hauer s.hauer at pengutronix.de
Tue Sep 24 03:08:37 EDT 2013


fdt is allocated, free it in error case.

Signed-off-by: Sascha Hauer <s.hauer at pengutronix.de>
---
 common/bootm.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/common/bootm.c b/common/bootm.c
index 1987a09..1ddc6d2 100644
--- a/common/bootm.c
+++ b/common/bootm.c
@@ -167,6 +167,7 @@ static int bootm_open_oftree(struct image_data *data, const char *oftree, int nu
 	data->of_root_node = of_unflatten_dtb(NULL, fdt);
 	if (!data->of_root_node) {
 		pr_err("unable to unflatten devicetree\n");
+		free(fdt);
 		return -EINVAL;
 	}
 
-- 
1.8.4.rc3




More information about the barebox mailing list