semihosting: add semihosting_basedir command
[fw/openocd] / src / target / target.c
index 8a451883ba4ccdedca12408cd655ca2c51e61b6a..8edd632916a7877cacf4c5f25045f97b570221fe 100644 (file)
@@ -57,6 +57,7 @@
 #include "transport/transport.h"
 #include "arm_cti.h"
 #include "smp.h"
+#include "semihosting_common.h"
 
 /* default halt wait timeout (ms) */
 #define DEFAULT_HALT_TIMEOUT 5000
@@ -2258,6 +2259,8 @@ static void target_destroy(struct target *target)
        if (target->type->deinit_target)
                target->type->deinit_target(target);
 
+       if (target->semihosting)
+               free(target->semihosting->basedir);
        free(target->semihosting);
 
        jtag_unregister_event_callback(jtag_enable_callback, target);