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
This commit is contained in:
Tomas Vanek 2018-02-15 00:56:44 +01:00
parent 33a3355304
commit 63d7688245
1 changed files with 13 additions and 6 deletions

View File

@ -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;
}