summaryrefslogtreecommitdiffstats
path: root/contrib/binutils/gas/stabs.c
diff options
context:
space:
mode:
authorobrien <obrien@FreeBSD.org>2001-06-26 16:57:43 +0000
committerobrien <obrien@FreeBSD.org>2001-06-26 16:57:43 +0000
commitbc13a0c5958e501561da1e6b4a3ca1fadda52059 (patch)
tree8f1caef823fb6443d77eaf8250cbaa506e3bdf46 /contrib/binutils/gas/stabs.c
parent328e45595b12375b6d16a846069507d25086abdb (diff)
downloadFreeBSD-src-bc13a0c5958e501561da1e6b4a3ca1fadda52059.zip
FreeBSD-src-bc13a0c5958e501561da1e6b4a3ca1fadda52059.tar.gz
Import of GNU Binutils version 2.11.2.
Diffstat (limited to 'contrib/binutils/gas/stabs.c')
-rw-r--r--contrib/binutils/gas/stabs.c18
1 files changed, 13 insertions, 5 deletions
diff --git a/contrib/binutils/gas/stabs.c b/contrib/binutils/gas/stabs.c
index faf3a9c..eed11b3 100644
--- a/contrib/binutils/gas/stabs.c
+++ b/contrib/binutils/gas/stabs.c
@@ -1,5 +1,5 @@
/* Generic stabs parsing for gas.
- Copyright (C) 1989, 90, 91, 93, 94, 95, 96, 97, 98, 99, 2000
+ Copyright 1989, 1990, 1991, 1993, 1995, 1996, 1997, 1998, 2000, 2001
Free Software Foundation, Inc.
This file is part of GAS, the GNU Assembler.
@@ -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 = "";
+ {
+ 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,8 +342,9 @@ s_stab_generic (what, stab_secname, stabstr_secname)
stroff = get_stab_string_offset (string, stabstr_secname);
if (what == 's')
{
- /* release the string */
- obstack_free (&notes, string);
+ /* Release the string, if nobody else has used the obstack. */
+ if (saved_string_obstack_end == notes.next_free)
+ obstack_free (&notes, string);
}
/* At least for now, stabs in a special stab section are always
OpenPOWER on IntegriCloud