diff options
author | Tomas Vanek <vanekt@fbl.cz> | 2018-02-15 00:56:44 +0100 |
---|---|---|
committer | Tomas Vanek <vanekt@fbl.cz> | 2018-03-15 17:09:09 +0000 |
commit | 63d768824550a9607daef9449eed422bd941ad32 (patch) | |
tree | 02152ef116ba2c98962454b9fd24c27689378e7d /src/jtag | |
parent | 33a33553046bc720800f410adbc81bc2fb175e74 (diff) | |
download | riscv-openocd-63d768824550a9607daef9449eed422bd941ad32.zip riscv-openocd-63d768824550a9607daef9449eed422bd941ad32.tar.gz riscv-openocd-63d768824550a9607daef9449eed422bd941ad32.tar.bz2 |
jtag/core: free all taps and daps in adapter_quit()
Change-Id: I74496f6ddfb0a72b2933e8d682a73a694b8d107b
Signed-off-by: Tomas Vanek <vanekt@fbl.cz>
Reviewed-on: http://openocd.zylin.com/4411
Tested-by: jenkins
Diffstat (limited to 'src/jtag')
-rw-r--r-- | src/jtag/core.c | 19 |
1 files changed, 13 insertions, 6 deletions
diff --git a/src/jtag/core.c b/src/jtag/core.c index 8c79eb2..df4afeb 100644 --- a/src/jtag/core.c +++ b/src/jtag/core.c @@ -1315,6 +1315,7 @@ void jtag_tap_free(struct jtag_tap *tap) free(tap->chip); free(tap->tapname); free(tap->dotted_name); + free(tap->dap); free(tap); } @@ -1472,13 +1473,19 @@ int jtag_init_inner(struct command_context *cmd_ctx) int adapter_quit(void) { - if (!jtag || !jtag->quit) - return ERROR_OK; + if (jtag && jtag->quit) { + /* close the JTAG interface */ + int result = jtag->quit(); + if (ERROR_OK != result) + LOG_ERROR("failed: %d", result); + } - /* close the JTAG interface */ - int result = jtag->quit(); - if (ERROR_OK != result) - LOG_ERROR("failed: %d", result); + struct jtag_tap *t = jtag_all_taps(); + while (t) { + struct jtag_tap *n = t->next_tap; + jtag_tap_free(t); + t = n; + } return ERROR_OK; } |