aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMichael Snyder <msnyder@vmware.com>2007-08-04 03:00:40 +0000
committerMichael Snyder <msnyder@vmware.com>2007-08-04 03:00:40 +0000
commit474d0d0c7af3f155a53223d1a4b6951aed2e30dc (patch)
tree58279595b5e49f0f6bcc135378c42f3e05b6cda9
parent03b4bca2d7c342aecb50a5874837aa4ef750460a (diff)
downloadgdb-474d0d0c7af3f155a53223d1a4b6951aed2e30dc.zip
gdb-474d0d0c7af3f155a53223d1a4b6951aed2e30dc.tar.gz
gdb-474d0d0c7af3f155a53223d1a4b6951aed2e30dc.tar.bz2
2007-08-03 Michael Snyder <msnyder@access-company.com>
* mi-cmd-var.c (mi_cmd_var_delete): Remove unused variable, stop memory leak, straighten out cleanups.
-rw-r--r--gdb/ChangeLog3
-rw-r--r--gdb/mi/mi-cmd-var.c8
2 files changed, 6 insertions, 5 deletions
diff --git a/gdb/ChangeLog b/gdb/ChangeLog
index b816273..fd8b262 100644
--- a/gdb/ChangeLog
+++ b/gdb/ChangeLog
@@ -1,5 +1,8 @@
2007-08-03 Michael Snyder <msnyder@access-company.com>
+ * mi-cmd-var.c (mi_cmd_var_delete): Remove unused variable,
+ stop memory leak, straighten out cleanups.
+
* jv-lang.c (java_link_class_type): Guard against NULL.
2007-08-02 Michael Snyder <msnyder@access-company.com>
diff --git a/gdb/mi/mi-cmd-var.c b/gdb/mi/mi-cmd-var.c
index be3160c..12d69ad 100644
--- a/gdb/mi/mi-cmd-var.c
+++ b/gdb/mi/mi-cmd-var.c
@@ -139,7 +139,6 @@ enum mi_cmd_result
mi_cmd_var_delete (char *command, char **argv, int argc)
{
char *name;
- char *expr;
struct varobj *var;
int numdel;
int children_only_p = 0;
@@ -167,13 +166,12 @@ mi_cmd_var_delete (char *command, char **argv, int argc)
which would be the variable name. */
if (argc == 2)
{
- expr = xstrdup (argv[1]);
if (strcmp (name, "-c") != 0)
error (_("mi_cmd_var_delete: Invalid option."));
children_only_p = 1;
- xfree (name);
- name = xstrdup (expr);
- xfree (expr);
+ do_cleanups (old_cleanups);
+ name = xstrdup (argv[1]);
+ make_cleanup (free_current_contents, &name);
}
/* If we didn't error out, now NAME contains the name of the