jtag: avoid checking for non NULL pointer to free it

The function free() can be called with a NULL pointer as argument,
no need to check the argument before. If the pointer is NULL, no
operation is performed by free().

Remove the occurrences of pattern:
	if (ptr)
		free(ptr);

Change-Id: I2938e333bd1eac5218bd67aefb9d8f373da017a8
Signed-off-by: Antonio Borneo <borneo.antonio@gmail.com>
Reviewed-on: http://openocd.zylin.com/5810
Tested-by: jenkins
This commit is contained in:
Antonio Borneo
2020-08-17 10:05:11 +02:00
parent a098a14eb5
commit 24db985f60
23 changed files with 60 additions and 122 deletions

View File

@@ -2537,15 +2537,9 @@ static int aice_usb_close(void)
{
jtag_libusb_close(aice_handler.usb_handle);
if (custom_srst_script)
free(custom_srst_script);
if (custom_trst_script)
free(custom_trst_script);
if (custom_restart_script)
free(custom_restart_script);
free(custom_srst_script);
free(custom_trst_script);
free(custom_restart_script);
return ERROR_OK;
}