aboutsummaryrefslogtreecommitdiff
path: root/gdb/varobj.c
diff options
context:
space:
mode:
authorMichael Snyder <msnyder@vmware.com>2007-08-08 21:46:37 +0000
committerMichael Snyder <msnyder@vmware.com>2007-08-08 21:46:37 +0000
commit6225abfaac49bed9804f8afea2109566b9c18c3d (patch)
tree7a7bd0aff5f81e16ea4884a3526a955044f86388 /gdb/varobj.c
parent3e40160c049b09b3a5a558f11c63e24c9afc634a (diff)
downloadgdb-6225abfaac49bed9804f8afea2109566b9c18c3d.zip
gdb-6225abfaac49bed9804f8afea2109566b9c18c3d.tar.gz
gdb-6225abfaac49bed9804f8afea2109566b9c18c3d.tar.bz2
2007-08-08 Michael Snyder <msnyder@access-company.com>
* varobj.c (value_of_root): Move alloc after return to avoid leak.
Diffstat (limited to 'gdb/varobj.c')
-rw-r--r--gdb/varobj.c3
1 files changed, 2 insertions, 1 deletions
diff --git a/gdb/varobj.c b/gdb/varobj.c
index c19bd20..dbeaff4 100644
--- a/gdb/varobj.c
+++ b/gdb/varobj.c
@@ -1710,13 +1710,14 @@ value_of_root (struct varobj **var_handle, int *type_changed)
{
struct varobj *tmp_var;
char *old_type, *new_type;
- old_type = varobj_get_type (var);
+
tmp_var = varobj_create (NULL, var->name, (CORE_ADDR) 0,
USE_SELECTED_FRAME);
if (tmp_var == NULL)
{
return NULL;
}
+ old_type = varobj_get_type (var);
new_type = varobj_get_type (tmp_var);
if (strcmp (old_type, new_type) == 0)
{