diff options
| author | Mark Wielaard <[email protected]> | 2015-06-18 11:07:41 +0200 |
|---|---|---|
| committer | Mark Wielaard <[email protected]> | 2015-06-19 12:33:27 +0200 |
| commit | 9beaa94e56fb8b717f838e02905e100647138bf9 (patch) | |
| tree | 1deb205bc0e50ffbf8548320b853ea4f8f34ef7e /src/nm.c | |
| parent | afd11605de0d2e16e8a2fa3094fa468b1901cd5e (diff) | |
nm: Fix typo in size check to determine whether we stack allocated memory.
We allocate GElf_SymX entries, which are larger than plain GElf_Sym structs.
The check to see whether we could use stack allocation used the correct
sizeof (GElf_SymX), but the check to see if we needed to free was using
the incorrect sizeof (GElf_Sym). Which could cause us to leak memory.
Signed-off-by: Mark Wielaard <[email protected]>
Diffstat (limited to 'src/nm.c')
| -rw-r--r-- | src/nm.c | 2 |
1 files changed, 1 insertions, 1 deletions
@@ -1383,7 +1383,7 @@ show_symbols (Ebl *ebl, GElf_Ehdr *ehdr, Elf_Scn *scn, Elf_Scn *xndxscn, } /* Free all memory. */ - if (nentries * sizeof (GElf_Sym) >= MAX_STACK_ALLOC) + if (nentries * sizeof (sym_mem[0]) >= MAX_STACK_ALLOC) free (sym_mem); obstack_free (&whereob, NULL); |
