summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMichael Snyder <msnyder@specifix.com>2007-08-08 18:01:35 +0000
committerMichael Snyder <msnyder@specifix.com>2007-08-08 18:01:35 +0000
commitd7e42836e6975b1b3ff31fb2a144f0cd85234861 (patch)
treed86939fcd9c0e607779e382e470e8ca8698fa27e
parent6dcf6cd3303b9a313851d4b91f5b6b8b95124fe1 (diff)
downloadgdb-d7e42836e6975b1b3ff31fb2a144f0cd85234861.tar.gz
2007-08-08 Michael Snyder <msnyder@access-company.com>
* dwarf2read.c (add_partial_symbol): Memory leak.
-rw-r--r--gdb/ChangeLog4
-rw-r--r--gdb/dwarf2read.c16
2 files changed, 15 insertions, 5 deletions
diff --git a/gdb/ChangeLog b/gdb/ChangeLog
index 46ba5395784..d657eea21c1 100644
--- a/gdb/ChangeLog
+++ b/gdb/ChangeLog
@@ -1,3 +1,7 @@
+2007-08-08 Michael Snyder <msnyder@access-company.com>
+
+ * dwarf2read.c (add_partial_symbol): Memory leak.
+
2007-08-06 Michael Snyder <msnyder@access-company.com>
* ada-lang.c (desc_bounds): Comparison of function address to NULL.
diff --git a/gdb/dwarf2read.c b/gdb/dwarf2read.c
index c12e3da6279..9cc1b568d9d 100644
--- a/gdb/dwarf2read.c
+++ b/gdb/dwarf2read.c
@@ -1886,7 +1886,7 @@ add_partial_symbol (struct partial_die_info *pdi, struct dwarf2_cu *cu)
{
struct objfile *objfile = cu->objfile;
CORE_ADDR addr = 0;
- char *actual_name;
+ char *actual_name = NULL;
const char *my_prefix;
const struct partial_symbol *psym = NULL;
CORE_ADDR baseaddr;
@@ -1894,8 +1894,6 @@ add_partial_symbol (struct partial_die_info *pdi, struct dwarf2_cu *cu)
baseaddr = ANOFFSET (objfile->section_offsets, SECT_OFF_TEXT (objfile));
- actual_name = NULL;
-
if (pdi_needs_namespace (pdi->tag))
{
actual_name = partial_die_full_name (pdi, cu);
@@ -1959,7 +1957,11 @@ add_partial_symbol (struct partial_die_info *pdi, struct dwarf2_cu *cu)
{
/* Static Variable. Skip symbols without location descriptors. */
if (pdi->locdesc == NULL)
- return;
+ {
+ if (built_actual_name)
+ xfree (actual_name);
+ return;
+ }
addr = decode_locdesc (pdi->locdesc, cu);
/*prim_record_minimal_symbol (actual_name, addr + baseaddr,
mst_file_data, objfile); */
@@ -1994,7 +1996,11 @@ add_partial_symbol (struct partial_die_info *pdi, struct dwarf2_cu *cu)
union or class entry that does not have a byte size attribute
and that has a DW_AT_declaration attribute." */
if (!pdi->has_byte_size && pdi->is_declaration)
- return;
+ {
+ if (built_actual_name)
+ xfree (actual_name);
+ return;
+ }
/* NOTE: carlton/2003-10-07: See comment in new_symbol about
static vs. global. */