aboutsummaryrefslogtreecommitdiff
path: root/gdb/cp-abi.c
diff options
context:
space:
mode:
authorSimon Marchi <simon.marchi@efficios.com>2020-05-21 13:12:29 -0400
committerSimon Marchi <simon.marchi@efficios.com>2020-05-21 13:12:29 -0400
commit84d53fa9d281f057af5916f8663bc9a2872c5f6e (patch)
treef6b7498d254e80fcd821b61642ff3f834be7953c /gdb/cp-abi.c
parent0490dd41ae89e66efd8b3cee122c189a481269de (diff)
downloadgdb-84d53fa9d281f057af5916f8663bc9a2872c5f6e.zip
gdb-84d53fa9d281f057af5916f8663bc9a2872c5f6e.tar.gz
gdb-84d53fa9d281f057af5916f8663bc9a2872c5f6e.tar.bz2
gdb: remove unnecessary NULL checks before xfree
I was inspired by a series of patches merged by Alan Modra in the other projects, so I did the same in GDB with a bit of Coccinelle and grep. This patch removes the unnecessary NULL checks before calls to xfree. They are unnecessary because xfree already does a NULL check. Since free is supposed to handle NULL values correctly, the NULL check in xfree itself is also questionable, but I've left it there for now. gdb/ChangeLog: * coffread.c (patch_type): Remove NULL check before xfree. * corefile.c (set_gnutarget): Likewise. * cp-abi.c (set_cp_abi_as_auto_default): Likewise. * exec.c (build_section_table): Likewise. * remote.c (remote_target::pass_signals): Likewise. * utils.c (n_spaces): Likewise. * cli/cli-script.c (document_command): Likewise. * i386-windows-tdep.c (core_process_module_section): Likewise. * linux-fork.c (struct fork_info) <~fork_info>: Likewise.
Diffstat (limited to 'gdb/cp-abi.c')
-rw-r--r--gdb/cp-abi.c6
1 files changed, 2 insertions, 4 deletions
diff --git a/gdb/cp-abi.c b/gdb/cp-abi.c
index 6997a7b..3e2edad 100644
--- a/gdb/cp-abi.c
+++ b/gdb/cp-abi.c
@@ -273,10 +273,8 @@ set_cp_abi_as_auto_default (const char *short_name)
_("Cannot find C++ ABI \"%s\" to set it as auto default."),
short_name);
- if (auto_cp_abi.longname != NULL)
- xfree ((char *) auto_cp_abi.longname);
- if (auto_cp_abi.doc != NULL)
- xfree ((char *) auto_cp_abi.doc);
+ xfree ((char *) auto_cp_abi.longname);
+ xfree ((char *) auto_cp_abi.doc);
auto_cp_abi = *abi;