forked from Imagelibrary/binutils-gdb
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.
This commit is contained in:
@@ -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);
|
||||
|
||||
Reference in New Issue
Block a user