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 <vanekt@fbl.cz>
Reviewed-on: http://openocd.zylin.com/4474
Tested-by: jenkins
Reviewed-by: Matthias Welwarsky <matthias@welwarsky.de>
{
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);
unregister_all_commands(cmd_ctx, NULL);
+ adapter_quit();
+
/* Shutdown commandline interface */
command_exit(cmd_ctx);
- adapter_quit();
-
free_config();
if (ERROR_FAIL == ret)
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;