From fd749173cf0bf3dd302c2a822c8d75619ff3ef0a Mon Sep 17 00:00:00 2001 From: Robin Gareus Date: Tue, 20 Jun 2023 18:19:33 +0200 Subject: [PATCH] Fix use-after free when deleting locations --- libs/ardour/location.cc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/libs/ardour/location.cc b/libs/ardour/location.cc index 2fece2adc3..866b4ba3e4 100644 --- a/libs/ardour/location.cc +++ b/libs/ardour/location.cc @@ -1139,7 +1139,6 @@ Locations::remove (Location *loc) _session.set_auto_punch_location (0); lm.acquire (); } - delete *i; locations.erase (i); was_removed = true; if (current_location == loc) { @@ -1168,6 +1167,7 @@ Locations::remove (Location *loc) if (was_current) { current_changed (0); /* EMIT SIGNAL */ } + delete loc; } }