target/target.c: free semihosting member 52/4552/2
authorLiviu Ionescu <ilg@livius.net>
Tue, 5 Jun 2018 14:34:47 +0000 (17:34 +0300)
committerMatthias Welwarsky <matthias@welwarsky.de>
Wed, 6 Jun 2018 14:22:51 +0000 (15:22 +0100)
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>
src/target/target.c

index c9b2006..7ab13b0 100644 (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;