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.
This commit is contained in:
Simon Marchi 2020-05-21 13:12:29 -04:00
parent 0490dd41ae
commit 84d53fa9d2
11 changed files with 24 additions and 22 deletions

View file

@ -61,8 +61,8 @@ struct fork_info
if (savedregs)
delete savedregs;
if (filepos)
xfree (filepos);
xfree (filepos);
}
ptid_t ptid = null_ptid;