PR23952, memory leak in _bfd_generic_read_minisymbols
bfd/ PR 23952 * syms.c (_bfd_generic_read_minisymbols): Free syms before returning with zero symcount. binutils/ * nm.c (display_rel_file): Use xrealloc to increase minisyms for synthetic symbols.
This commit is contained in:
parent
af03af8f55
commit
c2f5dc30af
@ -1,3 +1,9 @@
|
|||||||
|
2018-12-07 Alan Modra <amodra@gmail.com>
|
||||||
|
|
||||||
|
PR 23952
|
||||||
|
* syms.c (_bfd_generic_read_minisymbols): Free syms before
|
||||||
|
returning with zero symcount.
|
||||||
|
|
||||||
2018-12-06 Alan Modra <amodra@gmail.com>
|
2018-12-06 Alan Modra <amodra@gmail.com>
|
||||||
|
|
||||||
* elf32-ppc.c (ppc_elf_howto_raw <R_PPC_VLE_ADDR20>): Correct
|
* elf32-ppc.c (ppc_elf_howto_raw <R_PPC_VLE_ADDR20>): Correct
|
||||||
|
13
bfd/syms.c
13
bfd/syms.c
@ -822,9 +822,16 @@ _bfd_generic_read_minisymbols (bfd *abfd,
|
|||||||
if (symcount < 0)
|
if (symcount < 0)
|
||||||
goto error_return;
|
goto error_return;
|
||||||
|
|
||||||
*minisymsp = syms;
|
if (symcount == 0)
|
||||||
*sizep = sizeof (asymbol *);
|
/* We return 0 above when storage is 0. Exit in the same state
|
||||||
|
here, so as to not complicate callers with having to deal with
|
||||||
|
freeing memory for zero symcount. */
|
||||||
|
free (syms);
|
||||||
|
else
|
||||||
|
{
|
||||||
|
*minisymsp = syms;
|
||||||
|
*sizep = sizeof (asymbol *);
|
||||||
|
}
|
||||||
return symcount;
|
return symcount;
|
||||||
|
|
||||||
error_return:
|
error_return:
|
||||||
|
@ -1,3 +1,8 @@
|
|||||||
|
2018-12-07 Alan Modra <amodra@gmail.com>
|
||||||
|
|
||||||
|
* nm.c (display_rel_file): Use xrealloc to increase minisyms
|
||||||
|
for synthetic symbols.
|
||||||
|
|
||||||
2018-12-07 Nick Clifton <nickc@redhat.com>
|
2018-12-07 Nick Clifton <nickc@redhat.com>
|
||||||
|
|
||||||
* addr2line.c (demangle_flags): New static variable.
|
* addr2line.c (demangle_flags): New static variable.
|
||||||
|
@ -1175,17 +1175,14 @@ display_rel_file (bfd *abfd, bfd *archive_bfd)
|
|||||||
if (synth_count > 0)
|
if (synth_count > 0)
|
||||||
{
|
{
|
||||||
asymbol **symp;
|
asymbol **symp;
|
||||||
void *new_mini;
|
|
||||||
long i;
|
long i;
|
||||||
|
|
||||||
new_mini = xmalloc ((symcount + synth_count + 1) * sizeof (*symp));
|
minisyms = xrealloc (minisyms,
|
||||||
symp = (asymbol **) new_mini;
|
(symcount + synth_count + 1) * sizeof (*symp));
|
||||||
memcpy (symp, minisyms, symcount * sizeof (*symp));
|
symp = (asymbol **) minisyms + symcount;
|
||||||
symp += symcount;
|
|
||||||
for (i = 0; i < synth_count; i++)
|
for (i = 0; i < synth_count; i++)
|
||||||
*symp++ = synthsyms + i;
|
*symp++ = synthsyms + i;
|
||||||
*symp = 0;
|
*symp = 0;
|
||||||
minisyms = new_mini;
|
|
||||||
symcount += synth_count;
|
symcount += synth_count;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user