9
0
Fork 0

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>
This commit is contained in:
Michael Grzeschik 2015-07-24 15:20:24 +02:00 committed by Sascha Hauer
parent efeeea3501
commit f53a2c1bfa
1 changed files with 3 additions and 2 deletions

View File

@ -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");