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