aboutsummaryrefslogtreecommitdiff
path: root/bfd
diff options
context:
space:
mode:
authorAlan Modra <amodra@gmail.com>2025-01-11 15:58:03 +1030
committerAlan Modra <amodra@gmail.com>2025-01-15 22:37:17 +1030
commit04aeeb697e70806ac5ffb941a0359f125b2f71cf (patch)
tree0e08c33c39de815bdb5accdf6b4fb3ef790ec345 /bfd
parent049467c758efe4460220f045205dc61fb69ef5ef (diff)
downloadbinutils-04aeeb697e70806ac5ffb941a0359f125b2f71cf.zip
binutils-04aeeb697e70806ac5ffb941a0359f125b2f71cf.tar.gz
binutils-04aeeb697e70806ac5ffb941a0359f125b2f71cf.tar.bz2
bfd_get_unique_section_name leak
The name returned by this function is used in asection->name, so needs to persist until a bfd is closed. * section.c (bfd_get_unique_section_name): Return an alloc'd string.
Diffstat (limited to 'bfd')
-rw-r--r--bfd/section.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/bfd/section.c b/bfd/section.c
index e7674c9..ffd2891 100644
--- a/bfd/section.c
+++ b/bfd/section.c
@@ -1063,7 +1063,7 @@ bfd_get_unique_section_name (bfd *abfd, const char *templat, int *count)
char *sname;
len = strlen (templat);
- sname = (char *) bfd_malloc (len + 8);
+ sname = bfd_alloc (abfd, len + 8);
if (sname == NULL)
return NULL;
memcpy (sname, templat, len);