aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKeith Seitz <keiths@redhat.com>2001-11-20 18:08:14 +0000
committerKeith Seitz <keiths@redhat.com>2001-11-20 18:08:14 +0000
commit5bbc1a8e410369b785d3e51bf4c841221d139bb4 (patch)
tree280304edc8d96e56adb5e01aaa74940d437e9ca2
parent1ad24239ce0af556836897b96f29c7475042c009 (diff)
downloadgdb-5bbc1a8e410369b785d3e51bf4c841221d139bb4.zip
gdb-5bbc1a8e410369b785d3e51bf4c841221d139bb4.tar.gz
gdb-5bbc1a8e410369b785d3e51bf4c841221d139bb4.tar.bz2
* varobj.c (c_value_of_child): Release memory for "name" when
finshed using it. (c_type_of_child): Likewise. (cplus_value_of_child): Isolate the use of name_of_child to one case that needs it. Release memory for "name" when finished using it.
-rw-r--r--gdb/ChangeLog9
-rw-r--r--gdb/varobj.c8
2 files changed, 15 insertions, 2 deletions
diff --git a/gdb/ChangeLog b/gdb/ChangeLog
index 392ccda..914d32b 100644
--- a/gdb/ChangeLog
+++ b/gdb/ChangeLog
@@ -1,5 +1,14 @@
2001-11-20 Keith Seitz <keiths@redhat.com>
+ * varobj.c (c_value_of_child): Release memory for "name" when
+ finshed using it.
+ (c_type_of_child): Likewise.
+ (cplus_value_of_child): Isolate the use of name_of_child to
+ one case that needs it.
+ Release memory for "name" when finished using it.
+
+2001-11-20 Keith Seitz <keiths@redhat.com>
+
* top.c (gdb_init): Call init_ui_hook before initializing
the default UI.
diff --git a/gdb/varobj.c b/gdb/varobj.c
index 88af3e9..4cf6204 100644
--- a/gdb/varobj.c
+++ b/gdb/varobj.c
@@ -1977,6 +1977,7 @@ c_value_of_child (struct varobj *parent, int index)
if (value != NULL)
release_value (value);
+ xfree (name);
return value;
}
@@ -2019,6 +2020,7 @@ c_type_of_child (struct varobj *parent, int index)
break;
}
+ xfree (name);
return type;
}
@@ -2281,7 +2283,6 @@ cplus_value_of_child (struct varobj *parent, int index)
{
struct type *type;
struct value *value;
- char *name;
if (CPLUS_FAKE_CHILD (parent))
type = get_type_deref (parent->parent);
@@ -2289,19 +2290,22 @@ cplus_value_of_child (struct varobj *parent, int index)
type = get_type_deref (parent);
value = NULL;
- name = name_of_child (parent, index);
if (((TYPE_CODE (type)) == TYPE_CODE_STRUCT) ||
((TYPE_CODE (type)) == TYPE_CODE_UNION))
{
if (CPLUS_FAKE_CHILD (parent))
{
+ char *name;
struct value *temp = parent->parent->value;
+ name = name_of_child (parent, index);
gdb_value_struct_elt (NULL, &value, &temp, NULL, name, NULL,
"cplus_structure");
if (value != NULL)
release_value (value);
+
+ xfree (name);
}
else if (index >= TYPE_N_BASECLASSES (type))
{