From 393dc06bf81c40afe63b6d3d85848d1993fb9148 Mon Sep 17 00:00:00 2001 From: Andreas Fabri Date: Thu, 16 Jun 2022 12:34:30 +0100 Subject: [PATCH 1/2] STL_extension: Fix memory leak in Skiplist --- STL_Extension/include/CGAL/Skiplist.h | 3 +++ 1 file changed, 3 insertions(+) diff --git a/STL_Extension/include/CGAL/Skiplist.h b/STL_Extension/include/CGAL/Skiplist.h index 3410f0e0e06..68c14cf1726 100644 --- a/STL_Extension/include/CGAL/Skiplist.h +++ b/STL_Extension/include/CGAL/Skiplist.h @@ -234,8 +234,11 @@ public: void pop_back() { + Node& a = all_.back(); all_.pop_back(); skip_.pop_back(); + Node* ap = &a; + delete ap; } /// Insert \c t before \c pos in the all_view. \t will not be inserted into the skip view. From 34ad8040658c246ea12a40b87ac1352d9b9feb49 Mon Sep 17 00:00:00 2001 From: Andreas Fabri Date: Thu, 16 Jun 2022 14:46:36 +0100 Subject: [PATCH 2/2] Cleanup after Mael's code review --- STL_Extension/include/CGAL/Skiplist.h | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/STL_Extension/include/CGAL/Skiplist.h b/STL_Extension/include/CGAL/Skiplist.h index 68c14cf1726..3be7908c90c 100644 --- a/STL_Extension/include/CGAL/Skiplist.h +++ b/STL_Extension/include/CGAL/Skiplist.h @@ -234,11 +234,8 @@ public: void pop_back() { - Node& a = all_.back(); - all_.pop_back(); skip_.pop_back(); - Node* ap = &a; - delete ap; + all_.pop_back_and_dispose(Node_disposer()); } /// Insert \c t before \c pos in the all_view. \t will not be inserted into the skip view.