From 2547514abb90875bf47dda728ecaa9e30a5ab354 Mon Sep 17 00:00:00 2001 From: Dirk Zimoch Date: Tue, 28 Feb 2023 10:45:24 +0100 Subject: [PATCH] fix for use-after-free warning --- src/misc/pv/sharedVector.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/misc/pv/sharedVector.h b/src/misc/pv/sharedVector.h index 28322d3..905ee5e 100644 --- a/src/misc/pv/sharedVector.h +++ b/src/misc/pv/sharedVector.h @@ -434,11 +434,11 @@ public: _E_non_const* temp=new _E_non_const[i]; try{ std::copy(begin(), begin()+new_count, temp); - this->m_sdata.reset(temp, detail::default_array_deleter()); }catch(...){ delete[] temp; throw; } + this->m_sdata.reset(temp, detail::default_array_deleter()); this->m_offset = 0; this->m_count = new_count; this->m_total = i; @@ -481,11 +481,11 @@ public: std::copy(begin(), begin()+n, temp); - this->m_sdata.reset(temp, detail::default_array_deleter()); }catch(...){ delete[] temp; throw; } + this->m_sdata.reset(temp, detail::default_array_deleter()); this->m_offset= 0; this->m_count = i; this->m_total = new_total;