diff options
author | Andreas Fritiofson <andreas.fritiofson@gmail.com> | 2013-09-28 16:29:50 +0200 |
---|---|---|
committer | Spencer Oliver <spen@spen-soft.co.uk> | 2013-10-07 19:03:18 +0000 |
commit | d96010ae7125ced9a48613b5251a59249f519621 (patch) | |
tree | 9f9a395b6649ec948165fc5d6165e77afcb15a82 /src/jtag/tcl.c | |
parent | 2a0ed1ee7f2d0402cbadd93c8d3019bdb5f9370e (diff) | |
download | riscv-openocd-d96010ae7125ced9a48613b5251a59249f519621.zip riscv-openocd-d96010ae7125ced9a48613b5251a59249f519621.tar.gz riscv-openocd-d96010ae7125ced9a48613b5251a59249f519621.tar.bz2 |
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>
Diffstat (limited to 'src/jtag/tcl.c')
-rw-r--r-- | src/jtag/tcl.c | 7 |
1 files changed, 1 insertions, 6 deletions
diff --git a/src/jtag/tcl.c b/src/jtag/tcl.c index 227222e..fb060f9 100644 --- a/src/jtag/tcl.c +++ b/src/jtag/tcl.c @@ -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]); |