From 732f6b08c8b86c7cbdf7593cf820f55b6d9d7402 Mon Sep 17 00:00:00 2001 From: Igor Sfiligoi Date: Fri, 28 Apr 2023 09:52:38 -0700 Subject: [PATCH 1/2] Fix cleanup in PropStack destructor - was leaking memory --- src/unifrac_internal.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/unifrac_internal.cpp b/src/unifrac_internal.cpp index 087f575..f068ca9 100644 --- a/src/unifrac_internal.cpp +++ b/src/unifrac_internal.cpp @@ -88,7 +88,7 @@ PropStack::PropStack(uint32_t vecsize) template PropStack::~PropStack() { // drain stack - for(unsigned int i = 0; i < prop_stack.size(); i++) { + while (!prop_stack.empty()) { TFloat *vec = prop_stack.top(); prop_stack.pop(); free(vec); From 83264a7bf005170cbda2ef8907255a45bbad1034 Mon Sep 17 00:00:00 2001 From: Igor Sfiligoi Date: Fri, 28 Apr 2023 10:10:48 -0700 Subject: [PATCH 2/2] Fix cleanup in linked_sparse_transposed destructor - was leaking memory --- src/biom_subsampled.cpp | 1 + 1 file changed, 1 insertion(+) diff --git a/src/biom_subsampled.cpp b/src/biom_subsampled.cpp index 28757f2..5d154bd 100644 --- a/src/biom_subsampled.cpp +++ b/src/biom_subsampled.cpp @@ -73,6 +73,7 @@ linked_sparse_transposed::linked_sparse_transposed(sparse_data &other) linked_sparse_transposed::~linked_sparse_transposed() { if(obs_data_resident != NULL) { + for (uint32_t i=0; i