summaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
authorNathan Moinvaziri <nathan@nathanm.com>2020-11-08 18:26:06 -0800
committerHans Kristian Rosbach <hk-github@circlestorm.org>2020-11-10 18:05:20 +0100
commitc9933875a35ba09d1ba3c9faed16bd43a63e95d4 (patch)
tree3c37a2c474732445e38fa62ddd3b1cfdad8146fb /test
parentf1f775d1c3dbeac7064b85f48dcd23b06cf34bbd (diff)
Fixed coverity dereference after null check in gz_compress CID 303796.
Diffstat (limited to 'test')
-rw-r--r--test/minigzip.c5
1 files changed, 4 insertions, 1 deletions
diff --git a/test/minigzip.c b/test/minigzip.c
index 21cf8a3..2e4ef8e 100644
--- a/test/minigzip.c
+++ b/test/minigzip.c
@@ -101,7 +101,10 @@ void gz_compress(FILE *in, gzFile out) {
if (gz_compress_mmap(in, out) == Z_OK) return;
#endif
buf = (char *)calloc(BUFLEN, 1);
- if (buf == NULL) perror("out of memory");
+ if (buf == NULL) {
+ perror("out of memory");
+ exit(1);
+ }
for (;;) {
len = (int)fread(buf, 1, BUFLEN, in);