aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--tools/firmware-utils/src/dns313-header.c3
1 files changed, 3 insertions, 0 deletions
diff --git a/tools/firmware-utils/src/dns313-header.c b/tools/firmware-utils/src/dns313-header.c
index e69e57e7ba..3c72b09bfb 100644
--- a/tools/firmware-utils/src/dns313-header.c
+++ b/tools/firmware-utils/src/dns313-header.c
@@ -168,11 +168,14 @@ int main(int argc, char **argv)
fdin = open(pathin, O_RDONLY);
if (!fdin) {
printf("ERROR: could not open input file\n");
+ free(buffer);
return 0;
}
bytes = read(fdin, buffer + HEADER_SIZE, filesize);
if (bytes < filesize) {
printf("ERROR: could not read entire file\n");
+ free(buffer);
+ close(fdin);
return 0;
}
close(fdin);