This is an automated email from Gerrit. Tomas Vanek ([email protected]) just uploaded a new patch set to Gerrit, which you can find at http://openocd.zylin.com/4474
-- gerrit commit 4e52d4e3019fecdfbf120fefc491134e64475049 Author: Tomas Vanek <[email protected]> Date: Thu Mar 22 00:20:15 2018 +0100 jtag/core, target: unregister JTAG events Also call adapter_exit() before command_exit() as the latter releases Jim interpreter so JTAG events should be released before. Fixes memory leak reported by valgrind Change-Id: I493f3fcba34ea2b4234148e79a4e329c866e0f05 Signed-off-by: Tomas Vanek <[email protected]> diff --git a/src/jtag/core.c b/src/jtag/core.c index df4afeb..3b89c50 100644 --- a/src/jtag/core.c +++ b/src/jtag/core.c @@ -1308,6 +1308,14 @@ void jtag_tap_free(struct jtag_tap *tap) { jtag_unregister_event_callback(&jtag_reset_callback, tap); + struct jtag_tap_event_action *jteap = tap->event_action; + while (jteap) { + struct jtag_tap_event_action *next = jteap->next; + Jim_DecrRefCount(jteap->interp, jteap->body); + free(jteap); + jteap = next; + } + free(tap->expected); free(tap->expected_mask); free(tap->expected_ids); diff --git a/src/openocd.c b/src/openocd.c index 54fc83a..98dd9da 100644 --- a/src/openocd.c +++ b/src/openocd.c @@ -350,11 +350,11 @@ int openocd_main(int argc, char *argv[]) unregister_all_commands(cmd_ctx, NULL); + adapter_quit(); + /* Shutdown commandline interface */ command_exit(cmd_ctx); - adapter_quit(); - free_config(); if (ERROR_FAIL == ret) diff --git a/src/target/target.c b/src/target/target.c index bd9d56b..debd183 100644 --- a/src/target/target.c +++ b/src/target/target.c @@ -1892,6 +1892,8 @@ static void target_destroy(struct target *target) if (target->type->deinit_target) target->type->deinit_target(target); + jtag_unregister_event_callback(jtag_enable_callback, target); + struct target_event_action *teap = target->event_action; while (teap) { struct target_event_action *next = teap->next; -- ------------------------------------------------------------------------------ Check out the vibrant tech community on one of the world's most engaging tech sites, Slashdot.org! http://sdm.link/slashdot _______________________________________________ OpenOCD-devel mailing list [email protected] https://lists.sourceforge.net/lists/listinfo/openocd-devel
