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:
@@ -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;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user