summaryrefslogtreecommitdiffstats
path: root/arch/arm/mach-omap/xload.c
diff options
context:
space:
mode:
authorMichael Grzeschik <m.grzeschik@pengutronix.de>2015-07-24 15:20:24 +0200
committerSascha Hauer <s.hauer@pengutronix.de>2015-07-27 07:38:10 +0200
commitf53a2c1bfa87155e65b13bbd56bb4bc0836ebeed (patch)
tree49ec5bc5cb49ccb22e562969ea005c4098b1df96 /arch/arm/mach-omap/xload.c
parentefeeea3501639eb70d192eb88509b3cb79d9d44d (diff)
downloadbarebox-f53a2c1bfa87155e65b13bbd56bb4bc0836ebeed.tar.gz
barebox-f53a2c1bfa87155e65b13bbd56bb4bc0836ebeed.tar.xz
xload: fix use after free
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@pengutronix.de> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
Diffstat (limited to 'arch/arm/mach-omap/xload.c')
-rw-r--r--arch/arm/mach-omap/xload.c5
1 files changed, 3 insertions, 2 deletions
diff --git a/arch/arm/mach-omap/xload.c b/arch/arm/mach-omap/xload.c
index a013717213..3cf7ff4f68 100644
--- a/arch/arm/mach-omap/xload.c
+++ b/arch/arm/mach-omap/xload.c
@@ -119,13 +119,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");