https://sourceware.org/bugzilla/show_bug.cgi?id=23938
Bug ID: 23938
Summary: should not free memory alloced in obstack by free()
Product: binutils
Version: 2.32 (HEAD)
Status: UNCONFIRMED
Severity: normal
Priority: P2
Component: binutils
Assignee: unassigned at sourceware dot org
Reporter: wu.heng at zte dot com.cn
Target Milestone: ---
Created attachment 11420
--> https://sourceware.org/bugzilla/attachment.cgi?id=11420&action=edit
free obstack memory use obstack_free()
void
s_xstab (int what)
{
int length;
char *stab_secname, *stabstr_secname;
static char *saved_secname, *saved_strsecname;
/* @@ MEMORY LEAK: This allocates a copy of the string, but in most
cases it will be the same string, so we could release the storage
back to the obstack it came from. */
stab_secname = demand_copy_C_string (&length);
...
if (saved_secname)
{
free (saved_secname);
free (saved_strsecname);
}
...
}
The var "saved_secname" in "s_xstab" function which pointed to the memory
alloced in obstack, should not be freed in line 441:"free (saved_secname);".
--
You are receiving this mail because:
You are on the CC list for the bug.
_______________________________________________
bug-binutils mailing list
[email protected]
https://lists.gnu.org/mailman/listinfo/bug-binutils