From: Michael Snyder Date: Sat, 4 Aug 2007 03:00:40 +0000 (+0000) Subject: 2007-08-03 Michael Snyder X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=474d0d0c7af3f155a53223d1a4b6951aed2e30dc;p=binutils-gdb.git 2007-08-03 Michael Snyder * mi-cmd-var.c (mi_cmd_var_delete): Remove unused variable, stop memory leak, straighten out cleanups. --- diff --git a/gdb/ChangeLog b/gdb/ChangeLog index b8162736bad..fd8b2625fa2 100644 --- a/gdb/ChangeLog +++ b/gdb/ChangeLog @@ -1,5 +1,8 @@ 2007-08-03 Michael Snyder + * 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 diff --git a/gdb/mi/mi-cmd-var.c b/gdb/mi/mi-cmd-var.c index be3160c377e..12d69adbea8 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