[PATCH] xload: fix use after free
Michael Grzeschik
m.grzeschik at pengutronix.de
Fri Jul 24 06:20:24 PDT 2015
The variable partname is used in the error path for debugging.
We have to free it after this use.
Signed-off-by: Michael Grzeschik <m.grzeschik at pengutronix.de>
---
arch/arm/mach-omap/xload.c | 5 +++--
1 file changed, 3 insertions(+), 2 deletions(-)
diff --git a/arch/arm/mach-omap/xload.c b/arch/arm/mach-omap/xload.c
index 85c9120..3a33d6e 100644
--- a/arch/arm/mach-omap/xload.c
+++ b/arch/arm/mach-omap/xload.c
@@ -118,13 +118,14 @@ static void *omap_xload_boot_mmc(void)
ret = mount(partname, "fat", "/", NULL);
- free(partname);
-
if (ret) {
printf("Unable to mount %s (%d)\n", partname, ret);
+ free(partname);
return NULL;
}
+ free(partname);
+
buf = read_file("/barebox.bin", &len);
if (!buf) {
printf("could not read barebox.bin from sd card\n");
--
2.1.4
More information about the barebox
mailing list