From b2a536e9d71ced0c975f6a7dbbbef75d8f31174c Mon Sep 17 00:00:00 2001 From: Nate Rupsis Date: Thu, 16 Feb 2023 20:24:33 +0100 Subject: [PATCH] Fix: Remove the rest of the tracks in the BKE_nlatrack_remove_and_free to free up the memory Fix: The BKE_nlatrack_remove_and_free (#104752) unit test leaks a little memory. Cleaning up the rest of the track list to ensure everything is freed. Co-authored-by: Nate Rupsis Pull Request #104839 --- source/blender/blenkernel/intern/nla_test.cc | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/source/blender/blenkernel/intern/nla_test.cc b/source/blender/blenkernel/intern/nla_test.cc index e06fa496083..a844afdaff5 100644 --- a/source/blender/blenkernel/intern/nla_test.cc +++ b/source/blender/blenkernel/intern/nla_test.cc @@ -109,6 +109,11 @@ TEST(nla_track, BKE_nlatrack_remove_and_free) // ensure the correct track was removed. EXPECT_EQ(-1, BLI_findindex(&adt.nla_tracks, track2)); + + // free the rest of the tracks, and ensure they are removed. + BKE_nlatrack_remove_and_free(&adt.nla_tracks, track1, false); + EXPECT_EQ(0, BLI_listbase_count(&adt.nla_tracks)); + EXPECT_EQ(-1, BLI_findindex(&adt.nla_tracks, track1)); } } // namespace blender::bke::tests