aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDaniel Jacobowitz <drow@false.org>2004-02-22 19:26:43 +0000
committerDaniel Jacobowitz <drow@false.org>2004-02-22 19:26:43 +0000
commit9be5860a1812276984e7a71aab6018440d00cf10 (patch)
treea73424e0afb81cac78badd2fe9d2b840bf3ec10f
parent8df1ec34b7ffea86855ee9fe8ab8b96635c48b79 (diff)
downloadfsf-binutils-gdb-9be5860a1812276984e7a71aab6018440d00cf10.zip
fsf-binutils-gdb-9be5860a1812276984e7a71aab6018440d00cf10.tar.gz
fsf-binutils-gdb-9be5860a1812276984e7a71aab6018440d00cf10.tar.bz2
* dwarf2read.c (partial_die_full_name): Always return NULL or
malloc'd memory. Don't try to free real_parent->full_name.
-rw-r--r--gdb/ChangeLog.intercu5
-rw-r--r--gdb/dwarf2read.c14
2 files changed, 13 insertions, 6 deletions
diff --git a/gdb/ChangeLog.intercu b/gdb/ChangeLog.intercu
index f8f0412..2782fab 100644
--- a/gdb/ChangeLog.intercu
+++ b/gdb/ChangeLog.intercu
@@ -1,5 +1,10 @@
2004-02-22 Daniel Jacobowitz <drow@mvista.com>
+ * dwarf2read.c (partial_die_full_name): Always return NULL or
+ malloc'd memory. Don't try to free real_parent->full_name.
+
+2004-02-22 Daniel Jacobowitz <drow@mvista.com>
+
* dwarf2read.c (struct dwarf2_cu): Add read_in_chain and per_cu.
(dwarf2_cu_tree): New variable.
(struct dwarf2_per_cu_data): New type.
diff --git a/gdb/dwarf2read.c b/gdb/dwarf2read.c
index b2cffba..7b36f67 100644
--- a/gdb/dwarf2read.c
+++ b/gdb/dwarf2read.c
@@ -1688,13 +1688,13 @@ static char *
partial_die_full_name (struct partial_die_info *pdi,
struct dwarf2_cu *cu)
{
- char *parent_name, *full_name;
+ char *parent_name = NULL, *full_name;
struct partial_die_info *real_pdi, *real_parent;
struct dwarf2_cu *spec_cu;
int free_parent_name = 0;
- if (pdi->full_name_set)
- return pdi->full_name;
+ /* We shouldn't even have been called in this case. */
+ gdb_assert (!pdi->full_name_set);
/* Note: this code could probably be micro-optimized. We may be
able to avoid redoing the hash table lookup, and we might be able
@@ -1710,7 +1710,7 @@ partial_die_full_name (struct partial_die_info *pdi,
CU or later in this CU. It's correct, but somewhat inefficient. */
if (real_pdi->full_name_set)
- return real_pdi->full_name;
+ return xstrdup (real_pdi->full_name);
real_parent = real_pdi->die_parent;
if (real_parent == NULL)
@@ -1724,12 +1724,14 @@ partial_die_full_name (struct partial_die_info *pdi,
fixup_partial_die (real_parent, spec_cu);
parent_name = partial_die_full_name (real_parent, spec_cu);
/* Could cache the full name, too. */
- free_parent_name = 1;
+ if (parent_name != NULL)
+ free_parent_name = 1;
}
/* End hack zone. */
- parent_name = real_parent->full_name;
+ if (parent_name == NULL)
+ parent_name = real_parent->full_name;
if (parent_name == NULL)
parent_name = real_parent->name;