Skip to contentSkip to conversation

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

PATCH Applied Josh Law 1 participant 1 message Mar 6 Library code

lore
Share & tools
lore

Josh Law

author
#0 lore raw

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

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.

---
 lib/inflate.c | 2 ++
 1 file changed, 2 insertions(+)
lib/inflate.c +2 -0
index eab886baa1b4..5b1e70d0ce8c 100644
@@ -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;
   }
Signature · 1 line
2.43.0