target: Remove break/watchpoints in target_destroy()

Break- and watchpoints are not removed when a target is destroyed
which introduces a memory leak.

Change-Id: I6143d48f7efd765b7752a12fdc337da3496d896f
Signed-off-by: Marc Schink <dev@zapb.de>
Reviewed-on: https://review.openocd.org/c/openocd/+/7956
Reviewed-by: Marek Vrbka <marek.vrbka@codasip.com>
Reviewed-by: Tomas Vanek <vanekt@fbl.cz>
Tested-by: jenkins
Reviewed-by: Antonio Borneo <borneo.antonio@gmail.com>
This commit is contained in:
Marc Schink 2023-11-01 09:27:05 +01:00 committed by Antonio Borneo
parent d4575b647a
commit 3862e07688
1 changed files with 3 additions and 0 deletions

View File

@ -2212,6 +2212,9 @@ uint32_t target_get_working_area_avail(struct target *target)
static void target_destroy(struct target *target)
{
breakpoint_remove_all(target);
watchpoint_remove_all(target);
if (target->type->deinit_target)
target->type->deinit_target(target);