mail archive of the barebox mailing list
 help / color / mirror / Atom feed
* [PATCH] xload: fix use after free
@ 2015-07-24 13:20 Michael Grzeschik
  2015-07-27  5:38 ` Sascha Hauer
  0 siblings, 1 reply; 2+ messages in thread
From: Michael Grzeschik @ 2015-07-24 13:20 UTC (permalink / raw)
  To: barebox

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>
---
 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


_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2015-07-27  5:39 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2015-07-24 13:20 [PATCH] xload: fix use after free Michael Grzeschik
2015-07-27  5:38 ` Sascha Hauer

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox