From bbd53f1010b3d6a7b55d0094b2370c3a49322ddb Mon Sep 17 00:00:00 2001
From: Fabian Keil <fk@fabiankeil.de>
Date: Thu, 10 Sep 2020 18:22:13 +0200
Subject: [PATCH] decompress_iob(): Don't leak the memory allocated by
 inflateInit2()

... when the buffer limit is reached or we're running out of memory.
---
 parsers.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/parsers.c b/parsers.c
index ec3ad71e..48195f89 100644
--- 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
-- 
2.49.0