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

@@ -1155,10 +1155,8 @@ COMMAND_HANDLER(handle_irscan_command)
retval = jtag_execute_queue();
error_return:
for (i = 0; i < num_fields; i++) {
if (NULL != fields[i].out_value)
free((void *)fields[i].out_value);
}
for (i = 0; i < num_fields; i++)
free((void *)fields[i].out_value);
free(fields);