aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAlan Modra <amodra@gmail.com>2025-01-01 22:51:34 +1030
committerAlan Modra <amodra@gmail.com>2025-01-01 22:51:34 +1030
commitbc67f5df706ff54348b386669cadd686cdae0e71 (patch)
tree91bed6f73e05ae9a273e2883b52d1a137935da49
parent50dd43e6e3614d337e85a36aaed8224124fe3087 (diff)
downloadgdb-bc67f5df706ff54348b386669cadd686cdae0e71.zip
gdb-bc67f5df706ff54348b386669cadd686cdae0e71.tar.gz
gdb-bc67f5df706ff54348b386669cadd686cdae0e71.tar.bz2
thin archive with nested archive memory leak
The only reason to keep new_areldata around was for access to the filename, but we now always take a copy in alloc'd memory. * archive.c (_bfd_get_elt_at_filepos): Free new_areldata when it is not attached to bfd.
-rw-r--r--bfd/archive.c15
1 files changed, 5 insertions, 10 deletions
diff --git a/bfd/archive.c b/bfd/archive.c
index ee63ed7..b3019e2 100644
--- a/bfd/archive.c
+++ b/bfd/archive.c
@@ -708,20 +708,15 @@ _bfd_get_elt_at_filepos (bfd *archive, file_ptr filepos,
/* This proxy entry refers to an element of a nested archive.
Locate the member of that archive and return a bfd for it. */
bfd *ext_arch = find_nested_archive (filename, archive);
+ file_ptr origin = new_areldata->origin;
+ free (new_areldata);
if (ext_arch == NULL
|| ! bfd_check_format (ext_arch, bfd_archive))
- {
- free (new_areldata);
- return NULL;
- }
- n_bfd = _bfd_get_elt_at_filepos (ext_arch,
- new_areldata->origin, info);
+ return NULL;
+ n_bfd = _bfd_get_elt_at_filepos (ext_arch, origin, info);
if (n_bfd == NULL)
- {
- free (new_areldata);
- return NULL;
- }
+ return NULL;
n_bfd->proxy_origin = bfd_tell (archive);
/* Copy BFD_COMPRESS, BFD_DECOMPRESS and BFD_COMPRESS_GABI