mirror of
https://sourceware.org/git/binutils-gdb.git
synced 2024-11-24 10:35:12 +08:00
* stabs.c (s_stab_generic): Don't corrupt the notes obstack by
blindly freeing string if it isn't at the top of the obstack.
This commit is contained in:
parent
0015fd9aa4
commit
d68d457018
@ -1,3 +1,8 @@
|
||||
2001-03-15 DJ Delorie <dj@redhat.com>
|
||||
|
||||
* stabs.c (s_stab_generic): Don't corrupt the notes obstack by
|
||||
blindly freeing string if it isn't at the top of the obstack.
|
||||
|
||||
2001-03-13 Alan Modra <alan@linuxcare.com.au>
|
||||
|
||||
* config/tc-i386.c (RELOC_ENUM): Define. Use throughout file.
|
||||
|
12
gas/stabs.c
12
gas/stabs.c
@ -185,7 +185,7 @@ s_stab_generic (what, stab_secname, stabstr_secname)
|
||||
char *stabstr_secname;
|
||||
{
|
||||
long longint;
|
||||
char *string;
|
||||
char *string, *saved_string_obstack_end;
|
||||
int type;
|
||||
int other;
|
||||
int desc;
|
||||
@ -199,12 +199,19 @@ s_stab_generic (what, stab_secname, stabstr_secname)
|
||||
'd' indicating which type of .stab this is. */
|
||||
|
||||
if (what != 's')
|
||||
{
|
||||
string = "";
|
||||
saved_string_obstack_end = 0;
|
||||
}
|
||||
else
|
||||
{
|
||||
int length;
|
||||
|
||||
string = demand_copy_C_string (&length);
|
||||
/* FIXME: We should probably find some other temporary storage
|
||||
for string, rather than leaking memory if someone else
|
||||
happens to use the notes obstack. */
|
||||
saved_string_obstack_end = notes.next_free;
|
||||
SKIP_WHITESPACE ();
|
||||
if (*input_line_pointer == ',')
|
||||
input_line_pointer++;
|
||||
@ -335,7 +342,8 @@ s_stab_generic (what, stab_secname, stabstr_secname)
|
||||
stroff = get_stab_string_offset (string, stabstr_secname);
|
||||
if (what == 's')
|
||||
{
|
||||
/* release the string */
|
||||
/* Release the string, if nobody else has used the obstack. */
|
||||
if (saved_string_obstack_end == notes.next_free)
|
||||
obstack_free (¬es, string);
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user