+2015-06-18 Mark Wielaard <mjw@redhat.com>
+
+ * readelf.c (handle_gnu_hash): Free lengths on invalid_data.
+
2015-06-18 Mark Wielaard <mjw@redhat.com>
* elflint.c (check_symtab): Only check the PT_TLS phdr if it actually
static void
handle_gnu_hash (Ebl *ebl, Elf_Scn *scn, GElf_Shdr *shdr, size_t shstrndx)
{
+ uint32_t *lengths = NULL;
Elf_Data *data = elf_getdata (scn, NULL);
if (unlikely (data == NULL))
{
if (unlikely (data->d_size < 4 * sizeof (Elf32_Word)))
{
invalid_data:
+ free (lengths);
error (0, 0, gettext ("invalid data in gnu.hash section %d"),
(int) elf_ndxscn (scn));
return;
if (used_buf > data->d_size)
goto invalid_data;
- uint32_t *lengths = (uint32_t *) xcalloc (nbucket, sizeof (uint32_t));
+ lengths = (uint32_t *) xcalloc (nbucket, sizeof (uint32_t));
Elf32_Word *bitmask = &((Elf32_Word *) data->d_buf)[4];
Elf32_Word *bucket = &((Elf32_Word *) data->d_buf)[4 + bitmask_words];