From 7028f53877dad35a6aca58349160642bccbc9c83 Mon Sep 17 00:00:00 2001 From: Liviu Ionescu Date: Tue, 5 Jun 2018 17:34:47 +0300 Subject: [PATCH] target/target.c: free semihosting member When destroying the target, if the semihosting pointer is set, free it. Change-Id: I07d34918bb3fddab1eee11219dd66f4842708ec1 Signed-off-by: Liviu Ionescu Reviewed-on: http://openocd.zylin.com/4552 Tested-by: jenkins Reviewed-by: Tomas Vanek --- src/target/target.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/target/target.c b/src/target/target.c index c9b200638..7ab13b020 100644 --- a/src/target/target.c +++ b/src/target/target.c @@ -1893,6 +1893,9 @@ static void target_destroy(struct target *target) if (target->type->deinit_target) target->type->deinit_target(target); + if (target->semihosting) + free(target->semihosting); + jtag_unregister_event_callback(jtag_enable_callback, target); struct target_event_action *teap = target->event_action;