public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH] lib/inflate: fix memory leak in inflate_fixed() on inflate_codes() failure
@ 2026-03-06 16:16 Josh Law
  0 siblings, 0 replies; only message in thread
From: Josh Law @ 2026-03-06 16:16 UTC (permalink / raw)
  To: akpm; +Cc: linux-kernel, Josh Law

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


^ permalink raw reply related	[flat|nested] only message in thread

only message in thread, other threads:[~2026-03-06 16:16 UTC | newest]

Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-03-06 16:16 [PATCH] lib/inflate: fix memory leak in inflate_fixed() on inflate_codes() failure Josh Law

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox