Skip to content

Commit

Permalink
target: Remove break/watchpoints in target_destroy()
Browse files Browse the repository at this point in the history
Break- and watchpoints are not removed when a target is destroyed
which introduces a memory leak.

Change-Id: I6143d48f7efd765b7752a12fdc337da3496d896f
Signed-off-by: Marc Schink <[email protected]>
Reviewed-on: https://review.openocd.org/c/openocd/+/7956
Reviewed-by: Marek Vrbka <[email protected]>
Reviewed-by: Tomas Vanek <[email protected]>
Tested-by: jenkins
Reviewed-by: Antonio Borneo <[email protected]>
  • Loading branch information
zapb-0 authored and borneoa committed Nov 18, 2023
1 parent d4575b6 commit 3862e07
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions src/target/target.c
Original file line number Diff line number Diff line change
Expand Up @@ -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);

Expand Down

0 comments on commit 3862e07

Please sign in to comment.