mirror of
https://github.com/espressif/binutils-gdb.git
synced 2025-07-24 01:51:54 +08:00
Re: Memory leak in dwarf2.c
PR 11983 * dwarf2.c (read_alt_indirect_string): Free debug_filename on success. Tidy. (read_alt_indirect_ref): Likewise.
This commit is contained in:
@ -3,6 +3,8 @@
|
|||||||
PR 11983
|
PR 11983
|
||||||
* dwarf2.c (_bfd_dwarf2_slurp_debug_info): Free debug_filename
|
* dwarf2.c (_bfd_dwarf2_slurp_debug_info): Free debug_filename
|
||||||
on success. Tidy.
|
on success. Tidy.
|
||||||
|
(read_alt_indirect_string): Likewise.
|
||||||
|
(read_alt_indirect_ref): Likewise.
|
||||||
|
|
||||||
2019-08-31 Jim Wilson <jimw@sifive.com>
|
2019-08-31 Jim Wilson <jimw@sifive.com>
|
||||||
|
|
||||||
|
30
bfd/dwarf2.c
30
bfd/dwarf2.c
@ -808,14 +808,15 @@ read_alt_indirect_string (struct comp_unit * unit,
|
|||||||
if (debug_filename == NULL)
|
if (debug_filename == NULL)
|
||||||
return NULL;
|
return NULL;
|
||||||
|
|
||||||
if ((debug_bfd = bfd_openr (debug_filename, NULL)) == NULL
|
debug_bfd = bfd_openr (debug_filename, NULL);
|
||||||
|| ! bfd_check_format (debug_bfd, bfd_object))
|
|
||||||
{
|
|
||||||
if (debug_bfd)
|
|
||||||
bfd_close (debug_bfd);
|
|
||||||
|
|
||||||
/* FIXME: Should we report our failure to follow the debuglink ? */
|
|
||||||
free (debug_filename);
|
free (debug_filename);
|
||||||
|
if (debug_bfd == NULL)
|
||||||
|
/* FIXME: Should we report our failure to follow the debuglink ? */
|
||||||
|
return NULL;
|
||||||
|
|
||||||
|
if (!bfd_check_format (debug_bfd, bfd_object))
|
||||||
|
{
|
||||||
|
bfd_close (debug_bfd);
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
stash->alt_bfd_ptr = debug_bfd;
|
stash->alt_bfd_ptr = debug_bfd;
|
||||||
@ -856,14 +857,15 @@ read_alt_indirect_ref (struct comp_unit * unit,
|
|||||||
if (debug_filename == NULL)
|
if (debug_filename == NULL)
|
||||||
return FALSE;
|
return FALSE;
|
||||||
|
|
||||||
if ((debug_bfd = bfd_openr (debug_filename, NULL)) == NULL
|
debug_bfd = bfd_openr (debug_filename, NULL);
|
||||||
|| ! bfd_check_format (debug_bfd, bfd_object))
|
|
||||||
{
|
|
||||||
if (debug_bfd)
|
|
||||||
bfd_close (debug_bfd);
|
|
||||||
|
|
||||||
/* FIXME: Should we report our failure to follow the debuglink ? */
|
|
||||||
free (debug_filename);
|
free (debug_filename);
|
||||||
|
if (debug_bfd == NULL)
|
||||||
|
/* FIXME: Should we report our failure to follow the debuglink ? */
|
||||||
|
return NULL;
|
||||||
|
|
||||||
|
if (!bfd_check_format (debug_bfd, bfd_object))
|
||||||
|
{
|
||||||
|
bfd_close (debug_bfd);
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
stash->alt_bfd_ptr = debug_bfd;
|
stash->alt_bfd_ptr = debug_bfd;
|
||||||
|
Reference in New Issue
Block a user