]> git.ipfire.org Git - thirdparty/zlib-ng.git/commitdiff
Fixed coverity dereference after null check in gz_compress CID 303796.
authorNathan Moinvaziri <nathan@nathanm.com>
Mon, 9 Nov 2020 02:26:06 +0000 (18:26 -0800)
committerHans Kristian Rosbach <hk-github@circlestorm.org>
Tue, 10 Nov 2020 17:05:20 +0000 (18:05 +0100)
test/minigzip.c

index 21cf8a36830b3d9771bbcecf0612450d725ca14f..2e4ef8e2a5202b31870236080b0ebcf19cc0657d 100644 (file)
@@ -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);