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 <ilg@livius.net>
Reviewed-on: http://openocd.zylin.com/4552
Tested-by: jenkins
Reviewed-by: Tomas Vanek <vanekt@fbl.cz>
riscv-compliance
Liviu Ionescu 2018-06-05 17:34:47 +03:00 committed by Matthias Welwarsky
parent ebf2d73340
commit 7028f53877
1 changed files with 3 additions and 0 deletions

View File

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