diff options
author | David Bauer <mail@david-bauer.net> | 2023-02-28 19:53:44 +0100 |
---|---|---|
committer | David Bauer <mail@david-bauer.net> | 2023-03-02 17:04:28 +0100 |
commit | 766270061305eb0ad18f241f907b321744b692bc (patch) | |
tree | 6152ea791c0a97430405ab8eea498a1f89ac3b45 /package | |
parent | 19817fa3f566eae499544cdb36bd68fe3d46a3cc (diff) | |
download | upstream-766270061305eb0ad18f241f907b321744b692bc.tar.gz upstream-766270061305eb0ad18f241f907b321744b692bc.tar.bz2 upstream-766270061305eb0ad18f241f907b321744b692bc.zip |
fritz-tools: fix segfault in caldata-extract
* Fix incorrect error message in case input file opening fails
* Don't close files in case the pointers are invalid
Signed-off-by: David Bauer <mail@david-bauer.net>
Diffstat (limited to 'package')
-rw-r--r-- | package/utils/fritz-tools/Makefile | 2 | ||||
-rw-r--r-- | package/utils/fritz-tools/src/fritz_cal_extract.c | 8 |
2 files changed, 6 insertions, 4 deletions
diff --git a/package/utils/fritz-tools/Makefile b/package/utils/fritz-tools/Makefile index a4d69bdf71..6e20b56ff8 100644 --- a/package/utils/fritz-tools/Makefile +++ b/package/utils/fritz-tools/Makefile @@ -1,7 +1,7 @@ include $(TOPDIR)/rules.mk PKG_NAME:=fritz-tools -PKG_RELEASE:=1 +PKG_RELEASE:=2 CMAKE_INSTALL:=1 include $(INCLUDE_DIR)/package.mk diff --git a/package/utils/fritz-tools/src/fritz_cal_extract.c b/package/utils/fritz-tools/src/fritz_cal_extract.c index 8156dfd1a7..2978d86e0c 100644 --- a/package/utils/fritz-tools/src/fritz_cal_extract.c +++ b/package/utils/fritz-tools/src/fritz_cal_extract.c @@ -210,7 +210,7 @@ int main(int argc, char **argv) if (argc > 1 && optind <= argc) { in = fopen(argv[optind], "r"); if (!in) { - perror("Failed to create output file"); + perror("Failed to open input file"); goto out_bad; } } @@ -253,7 +253,9 @@ out_bad: ret = EXIT_FAILURE; out: - fclose(in); - fclose(out); + if (in) + fclose(in); + if (out) + fclose(out); return ret; } |