[PATCH] lib/inflate: fix memory leak in inflate_fixed() on inflate_codes() failure

Josh Law posted 1 patch 1 month ago
lib/inflate.c | 2 ++
1 file changed, 2 insertions(+)
[PATCH] lib/inflate: fix memory leak in inflate_fixed() on inflate_codes() failure
Posted by Josh Law 1 month ago
When inflate_codes() fails in inflate_fixed(), only the length list 'l'
is freed, but the Huffman tables 'tl' and 'td' are leaked. Add the
missing huft_free() calls on the error path.

Signed-off-by: Josh Law <objecting@objecting.org>
---
 lib/inflate.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/lib/inflate.c b/lib/inflate.c
index eab886baa1b4..5b1e70d0ce8c 100644
--- a/lib/inflate.c
+++ b/lib/inflate.c
@@ -811,6 +811,8 @@ DEBG("<fix");
 
   /* decompress until an end-of-block code */
   if (inflate_codes(tl, td, bl, bd)) {
+    huft_free(tl);
+    huft_free(td);
     free(l);
     return 1;
   }
-- 
2.43.0