From 6cfdedc5e2f645ae56ad166ffbf158eb2971ab69 Mon Sep 17 00:00:00 2001 From: Jannick Borowitz Date: Thu, 1 Aug 2024 06:02:31 +0000 Subject: [PATCH] fix: memory leak in graph_access for wmis project --- wmis/extern/KaHIP/lib/data_structure/graph_access.h | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/wmis/extern/KaHIP/lib/data_structure/graph_access.h b/wmis/extern/KaHIP/lib/data_structure/graph_access.h index f98ad2c..7f8f748 100644 --- a/wmis/extern/KaHIP/lib/data_structure/graph_access.h +++ b/wmis/extern/KaHIP/lib/data_structure/graph_access.h @@ -447,6 +447,9 @@ inline void graph_access::set_partition_count(PartitionID count) { } inline int graph_access::build_from_metis(int n, int* xadj, int* adjncy) { + if(graphref != nullptr) { + delete graphref; + } graphref = new basicGraph(); start_construction(n, xadj[n]); @@ -467,6 +470,9 @@ inline int graph_access::build_from_metis(int n, int* xadj, int* adjncy) { } inline int graph_access::build_from_metis_weighted(int n, int* xadj, int* adjncy, int * vwgt, int* adjwgt) { + if(graphref != nullptr) { + delete graphref; + } graphref = new basicGraph(); start_construction(n, xadj[n]);