summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSascha Hauer <s.hauer@pengutronix.de>2018-01-25 08:41:27 +0100
committerSascha Hauer <s.hauer@pengutronix.de>2018-01-25 08:43:13 +0100
commit220e92bc20a74dd005ecf057d7de25e8db8b9b25 (patch)
tree400c24449a1db4fd518447afc633148ed6c6d478
parente660e511ae29b914cfc47413f5ac1107c2da0693 (diff)
downloadbarebox-220e92bc20a74dd005ecf057d7de25e8db8b9b25.tar.gz
barebox-220e92bc20a74dd005ecf057d7de25e8db8b9b25.tar.xz
uimage: fix memory leak in error path
handle->name is dynamically allocated, so free it in the error path. Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de> Reported-by: Stefan Lengfeld <contact@stefanchrist.eu>
-rw-r--r--common/uimage.c2
1 files changed, 2 insertions, 0 deletions
diff --git a/common/uimage.c b/common/uimage.c
index b6f0f109ca..e857c11d37 100644
--- a/common/uimage.c
+++ b/common/uimage.c
@@ -202,6 +202,8 @@ again:
return handle;
err_out:
close(fd);
+
+ free(handle->name);
free(handle);
if (IS_BUILTIN(CONFIG_FS_TFTP) && !stat(uimage_tmp, &s))
unlink(uimage_tmp);