target/arm11: fix memory leaks, including register cache
[fw/openocd] / src / target / arm11.c
index 10a1d6de5298a0e8259233092357910fb6da3c83..68d4e18944324e076053ce0b2e35005873c5ef77 100644 (file)
@@ -1131,6 +1131,14 @@ static int arm11_init_target(struct command_context *cmd_ctx,
        return ERROR_OK;
 }
 
+static void arm11_deinit_target(struct target *target)
+{
+       struct arm11_common *arm11 = target_to_arm11(target);
+
+       arm11_dpm_deinit(arm11);
+       free(arm11);
+}
+
 /* talk to the target and set things up */
 static int arm11_examine(struct target *target)
 {
@@ -1379,5 +1387,6 @@ struct target_type arm11_target = {
        .commands = arm11_command_handlers,
        .target_create = arm11_target_create,
        .init_target = arm11_init_target,
+       .deinit_target = arm11_deinit_target,
        .examine = arm11_examine,
 };