2007-08-08 Michael Snyder <msnyder@access-company.com>
authorMichael Snyder <msnyder@vmware.com>
Wed, 8 Aug 2007 21:46:37 +0000 (21:46 +0000)
committerMichael Snyder <msnyder@vmware.com>
Wed, 8 Aug 2007 21:46:37 +0000 (21:46 +0000)
* varobj.c (value_of_root): Move alloc after return to avoid leak.

gdb/ChangeLog
gdb/varobj.c

index ecef0e80acde38f4b4d80cfd3ca454dd858f60df..9e9724f1496c75c2f4b12d751fb9fba71f6f67c0 100644 (file)
@@ -1,5 +1,7 @@
 2007-08-08  Michael Snyder  <msnyder@access-company.com>
 
+       * varobj.c (value_of_root): Move alloc after return to avoid leak.
+
        * tui/tui-layout.c (tui_set_layout): Dead code, dead variable.
 
        * top.c (command_line_input): Memory leak.
index c19bd20c13fb0d71705f1b011b39b9173d29057c..dbeaff491a815c15e1270c583343ede7eb8fa06c 100644 (file)
@@ -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)
        {