]> git.ipfire.org Git - thirdparty/elfutils.git/commitdiff
elflint: Fix memory leak in check_gnu_hash function
authorMaks Mishin <maks.mishinfz@gmail.com>
Wed, 18 Sep 2024 08:58:07 +0000 (11:58 +0300)
committerAaron Merey <amerey@redhat.com>
Fri, 20 Sep 2024 15:51:28 +0000 (11:51 -0400)
Dynamic memory, referenced by 'collected', is allocated at elflint.c:2235
and lost at elflint.c:2296.

Found by RASU JSC with SVACE.

Signed-off-by: Maks Mishin <maks.mishinFZ@gmail.com>
src/elflint.c

index e56e1465dac637c4abc1aba76c12cd109fa158d3..cdc6108d928733fac9126d352ca80feea59a8505 100644 (file)
@@ -2293,6 +2293,7 @@ section [%2d] '%s': hash value for symbol %u in chain for bucket %zu wrong\n"),
 section [%2d] '%s': mask index for symbol %u in chain for bucket %zu wrong\n"),
                             idx, section_name (ebl, idx), symidx,
                             cnt - (4 + bitmask_words));
+                     free (collected.p32);
                      return;
                    }
                  if (classbits == 32)