From c9933875a35ba09d1ba3c9faed16bd43a63e95d4 Mon Sep 17 00:00:00 2001 From: Nathan Moinvaziri Date: Sun, 8 Nov 2020 18:26:06 -0800 Subject: [PATCH] Fixed coverity dereference after null check in gz_compress CID 303796. --- test/minigzip.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/test/minigzip.c b/test/minigzip.c index 21cf8a36..2e4ef8e2 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); -- 2.47.2