diff options
author | Paul Fertser <fercerpav@gmail.com> | 2015-11-06 20:53:55 +0300 |
---|---|---|
committer | Freddie Chopin <freddie.chopin@gmail.com> | 2015-11-13 06:55:26 +0000 |
commit | 60d570159012e33c221963a4c62a80a70b06301e (patch) | |
tree | 73592a913f21314fd4518f6d6fd9ef19364fae54 | |
parent | f3be0f60713dcfdc122406c95b7ed330cd7b8a3e (diff) |
target: cortex_a: add deinit_target handler to free memory
Tested with Valgrind accesing a Pandaboard.
Change-Id: I51bba044974ecfc4d418998816d44a8563264123
Signed-off-by: Paul Fertser <fercerpav@gmail.com>
Reviewed-on: http://openocd.zylin.com/3101
Tested-by: jenkins
Reviewed-by: Freddie Chopin <freddie.chopin@gmail.com>
-rw-r--r-- | src/target/cortex_a.c | 12 |
1 files changed, 12 insertions, 0 deletions
diff --git a/src/target/cortex_a.c b/src/target/cortex_a.c index d0260dae..e2d433a6 100644 --- a/src/target/cortex_a.c +++ b/src/target/cortex_a.c @@ -3121,6 +3121,16 @@ static int cortex_r4_target_create(struct target *target, Jim_Interp *interp) return cortex_a_init_arch_info(target, cortex_a, target->tap); } +static void cortex_a_deinit_target(struct target *target) +{ + struct cortex_a_common *cortex_a = target_to_cortex_a(target); + struct arm_dpm *dpm = &cortex_a->armv7a_common.dpm; + + free(cortex_a->brp_list); + free(dpm->dbp); + free(dpm->dwp); + free(cortex_a); +} static int cortex_a_mmu(struct target *target, int *enabled) { @@ -3365,6 +3375,7 @@ struct target_type cortexa_target = { .target_create = cortex_a_target_create, .init_target = cortex_a_init_target, .examine = cortex_a_examine, + .deinit_target = cortex_a_deinit_target, .read_phys_memory = cortex_a_read_phys_memory, .write_phys_memory = cortex_a_write_phys_memory, @@ -3449,4 +3460,5 @@ struct target_type cortexr4_target = { .target_create = cortex_r4_target_create, .init_target = cortex_a_init_target, .examine = cortex_a_examine, + .deinit_target = cortex_a_deinit_target, }; |