]> git.ipfire.org Git - thirdparty/linux.git/commit
lib/inflate: fix memory leak in inflate_dynamic() on inflate_codes() failure
authorJosh Law <objecting@objecting.org>
Fri, 6 Mar 2026 16:16:47 +0000 (16:16 +0000)
committerAndrew Morton <akpm@linux-foundation.org>
Sat, 28 Mar 2026 04:19:41 +0000 (21:19 -0700)
commit84f24da3544abb7b6db102191bf7f98230a3af30
tree64e95e4db1c51fc8232e02e9c29f23268a158ef7
parentbc6cc36855e9ebcf0c7e01f980ad67bcb0e50bdb
lib/inflate: fix memory leak in inflate_dynamic() on inflate_codes() failure

When inflate_codes() fails in inflate_dynamic(), the code jumps to the
'out' label which only frees 'll', leaking the Huffman tables 'tl' and
'td'.  Restructure the code so that the decoding tables are always freed
before reaching the 'out' label.

Link: https://lkml.kernel.org/r/20260306161647.2811874-1-objecting@objecting.org
Signed-off-by: Josh Law <objecting@objecting.org>
Reviewed-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
lib/inflate.c