decompress_iob(): Don't leak the memory allocated by inflateInit2()
authorFabian Keil <fk@fabiankeil.de>
Thu, 10 Sep 2020 16:22:13 +0000 (18:22 +0200)
committerFabian Keil <fk@fabiankeil.de>
Fri, 11 Sep 2020 14:35:39 +0000 (16:35 +0200)
... when the buffer limit is reached or we're running out of memory.

parsers.c

index ec3ad71..48195f8 100644 (file)
--- a/parsers.c
+++ b/parsers.c
@@ -727,6 +727,7 @@ jb_err decompress_iob(struct client_state *csp)
       {
          log_error(LOG_LEVEL_ERROR, "Buffer limit reached while decompressing iob");
          freez(buf);
+         inflateEnd(&zstr);
          return JB_ERR_MEMORY;
       }
 
@@ -745,6 +746,7 @@ jb_err decompress_iob(struct client_state *csp)
       {
          log_error(LOG_LEVEL_ERROR, "Out of memory decompressing iob");
          freez(buf);
+         inflateEnd(&zstr);
          return JB_ERR_MEMORY;
       }
       else