readelf memory leaks
This fixes two leaks found in the new code supporting display of dynamic symbols retrieved via dynamic tags. * readelf.c (get_num_dynamic_syms): Formatting. Don't return on error without freeing. (process_dynamic_section): Don't recreate dynamic symbols from dynamic tag info when the dynamic symbols have already been read via section headers.
This commit is contained in:
parent
2efec98b28
commit
ceb9bf11b9
@ -1,3 +1,11 @@
|
|||||||
|
2020-04-20 Alan Modra <amodra@gmail.com>
|
||||||
|
|
||||||
|
* readelf.c (get_num_dynamic_syms): Formatting. Don't return
|
||||||
|
on error without freeing.
|
||||||
|
(process_dynamic_section): Don't recreate dynamic symbols from
|
||||||
|
dynamic tag info when the dynamic symbols have already been
|
||||||
|
read via section headers.
|
||||||
|
|
||||||
2020-04-17 Fredrik Strupe <fredrik@strupe.net>
|
2020-04-17 Fredrik Strupe <fredrik@strupe.net>
|
||||||
|
|
||||||
* testsuite/binutils-all/arm/vdup-cond.d: New test for testing that
|
* testsuite/binutils-all/arm/vdup-cond.d: New test for testing that
|
||||||
|
@ -9976,7 +9976,7 @@ get_num_dynamic_syms (Filedata * filedata)
|
|||||||
if (buckets != NULL && chains != NULL)
|
if (buckets != NULL && chains != NULL)
|
||||||
num_of_syms = nchains;
|
num_of_syms = nchains;
|
||||||
|
|
||||||
no_hash:
|
no_hash:
|
||||||
if (num_of_syms == 0)
|
if (num_of_syms == 0)
|
||||||
{
|
{
|
||||||
if (buckets)
|
if (buckets)
|
||||||
@ -10052,7 +10052,7 @@ get_num_dynamic_syms (Filedata * filedata)
|
|||||||
if (gnubuckets[i] < gnusymidx)
|
if (gnubuckets[i] < gnusymidx)
|
||||||
{
|
{
|
||||||
gnu_hash_error = TRUE;
|
gnu_hash_error = TRUE;
|
||||||
return FALSE;
|
goto no_gnu_hash;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (maxchain == 0xffffffff || gnubuckets[i] > maxchain)
|
if (maxchain == 0xffffffff || gnubuckets[i] > maxchain)
|
||||||
@ -10083,7 +10083,7 @@ get_num_dynamic_syms (Filedata * filedata)
|
|||||||
if (fread (nb, 4, 1, filedata->handle) != 1)
|
if (fread (nb, 4, 1, filedata->handle) != 1)
|
||||||
{
|
{
|
||||||
error (_("Failed to determine last chain length\n"));
|
error (_("Failed to determine last chain length\n"));
|
||||||
gnu_hash_error = TRUE;
|
gnu_hash_error = TRUE;
|
||||||
goto no_gnu_hash;
|
goto no_gnu_hash;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -10156,7 +10156,7 @@ get_num_dynamic_syms (Filedata * filedata)
|
|||||||
while (off < ngnuchains && (gnuchains[off++] & 1) == 0);
|
while (off < ngnuchains && (gnuchains[off++] & 1) == 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
no_gnu_hash:
|
no_gnu_hash:
|
||||||
if (gnu_hash_error)
|
if (gnu_hash_error)
|
||||||
{
|
{
|
||||||
if (mipsxlat)
|
if (mipsxlat)
|
||||||
@ -10260,7 +10260,8 @@ process_dynamic_section (Filedata * filedata)
|
|||||||
|
|
||||||
if (vma >= (seg->p_vaddr & -seg->p_align)
|
if (vma >= (seg->p_vaddr & -seg->p_align)
|
||||||
&& vma <= seg->p_vaddr + seg->p_filesz
|
&& vma <= seg->p_vaddr + seg->p_filesz
|
||||||
&& (num_of_syms = get_num_dynamic_syms (filedata)))
|
&& (num_of_syms = get_num_dynamic_syms (filedata)) != 0
|
||||||
|
&& dynamic_symbols == NULL)
|
||||||
{
|
{
|
||||||
/* Since we do not know how big the symbol table is,
|
/* Since we do not know how big the symbol table is,
|
||||||
we default to reading in up to the end of PT_LOAD
|
we default to reading in up to the end of PT_LOAD
|
||||||
|
Loading…
Reference in New Issue
Block a user