aboutsummaryrefslogtreecommitdiffstats
path: root/package/boot/uboot-oxnas
diff options
context:
space:
mode:
authorAndrea Dalla Costa <andrea@dallacosta.me>2019-12-28 17:43:40 +0100
committerJohn Crispin <john@phrozen.org>2020-01-15 23:15:19 +0100
commit5adca1cf2abc0c320be082522ab1ec747c7157b7 (patch)
tree67821e879d965745e55d96c420d4026c22fecd4c /package/boot/uboot-oxnas
parentbbab32b2e33dad65c0102d47e0263872ac857e32 (diff)
downloadupstream-5adca1cf2abc0c320be082522ab1ec747c7157b7.tar.gz
upstream-5adca1cf2abc0c320be082522ab1ec747c7157b7.tar.bz2
upstream-5adca1cf2abc0c320be082522ab1ec747c7157b7.zip
uboot-oxnas: fix memory leak in tool mkox820crc
In function `main` add calls to `free` for the variable `executable`. This is needed because the variable `executable` is allocated but never freed. This cause a memory leak. Signed-off-by: Andrea Dalla Costa <andrea@dallacosta.me>
Diffstat (limited to 'package/boot/uboot-oxnas')
-rw-r--r--package/boot/uboot-oxnas/src/tools/mkox820crc.c3
1 files changed, 3 insertions, 0 deletions
diff --git a/package/boot/uboot-oxnas/src/tools/mkox820crc.c b/package/boot/uboot-oxnas/src/tools/mkox820crc.c
index d100191f2d..873706245b 100644
--- a/package/boot/uboot-oxnas/src/tools/mkox820crc.c
+++ b/package/boot/uboot-oxnas/src/tools/mkox820crc.c
@@ -84,6 +84,7 @@ int main(int argc, char **argv)
if (status != file_length) {
printf("Failed to load image\n");
+ free(executable);
return -ENOENT;
}
@@ -111,6 +112,7 @@ int main(int argc, char **argv)
status = lseek(in_file, 0, SEEK_SET);
if (status != 0) {
printf("failed to rewind\n");
+ free(executable);
return 1;
}
len = write(in_file, &img_header, sizeof(img_header));
@@ -118,6 +120,7 @@ int main(int argc, char **argv)
len = write(in_file, executable, file_length);
assert(len == file_length);
close(in_file);
+ free(executable);
return 0;
}