From: Yao Qi Date: Fri, 20 Jul 2012 08:59:32 +0000 (+0000) Subject: gdb/ X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=c24343e28935f4ae36989a8e3f13b4f9cde23d3c;p=binutils-gdb.git gdb/ * cli/cli-setshow.c (do_setshow_command): Don't check pointer is NULL for xfree. --- diff --git a/gdb/ChangeLog b/gdb/ChangeLog index 60810d1c548..f88fbeb98a2 100644 --- a/gdb/ChangeLog +++ b/gdb/ChangeLog @@ -1,3 +1,8 @@ +2012-07-20 Yao Qi + + * cli/cli-setshow.c (do_setshow_command): Don't check pointer is + NULL for xfree. + 2012-07-19 Pedro Alves * record.c (record_resume): Ask the target beneath to report all diff --git a/gdb/cli/cli-setshow.c b/gdb/cli/cli-setshow.c index dccf4255429..5ec7b55881f 100644 --- a/gdb/cli/cli-setshow.c +++ b/gdb/cli/cli-setshow.c @@ -170,16 +170,14 @@ do_setshow_command (char *arg, int from_tty, struct cmd_list_element *c) #endif *q++ = '\0'; new = (char *) xrealloc (new, q - new); - if (*(char **) c->var != NULL) - xfree (*(char **) c->var); + xfree (*(char **) c->var); *(char **) c->var = new; } break; case var_string_noescape: if (arg == NULL) arg = ""; - if (*(char **) c->var != NULL) - xfree (*(char **) c->var); + xfree (*(char **) c->var); *(char **) c->var = xstrdup (arg); break; case var_filename: @@ -187,8 +185,7 @@ do_setshow_command (char *arg, int from_tty, struct cmd_list_element *c) error_no_arg (_("filename to set it to.")); /* FALLTHROUGH */ case var_optional_filename: - if (*(char **) c->var != NULL) - xfree (*(char **) c->var); + xfree (*(char **) c->var); if (arg != NULL) {