jtag/tcl: Remove no-op free
And use calloc instead of malloc+memset. Change-Id: Icc1ed6e34904972bb5d3728307dcae5c55b32fc3 Signed-off-by: Andreas Fritiofson <andreas.fritiofson@gmail.com> Reviewed-on: http://openocd.zylin.com/1666 Tested-by: jenkins Reviewed-by: Spencer Oliver <spen@spen-soft.co.uk>
This commit is contained in:
parent
2a0ed1ee7f
commit
d96010ae71
|
@ -1120,17 +1120,12 @@ COMMAND_HANDLER(handle_irscan_command)
|
|||
return ERROR_COMMAND_SYNTAX_ERROR;
|
||||
}
|
||||
|
||||
size_t fields_len = sizeof(struct scan_field) * num_fields;
|
||||
fields = malloc(fields_len);
|
||||
memset(fields, 0, fields_len);
|
||||
fields = calloc(num_fields, sizeof(*fields));
|
||||
|
||||
int retval;
|
||||
for (i = 0; i < num_fields; i++) {
|
||||
tap = jtag_tap_by_string(CMD_ARGV[i*2]);
|
||||
if (tap == NULL) {
|
||||
int j;
|
||||
for (j = 0; j < i; j++)
|
||||
free((void *)fields[j].out_value);
|
||||
free(fields);
|
||||
command_print(CMD_CTX, "Tap: %s unknown", CMD_ARGV[i*2]);
|
||||
|
||||
|
|
Loading…
Reference in New Issue