From d6c5367e85577a8d476ac1b0abace4e39eea928a Mon Sep 17 00:00:00 2001 From: dehnert Date: Tue, 14 Nov 2017 09:00:56 +0100 Subject: [PATCH] fix possible memory leak in bitvector --- src/storm/storage/BitVector.cpp | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/storm/storage/BitVector.cpp b/src/storm/storage/BitVector.cpp index 60fdf166b..924657b44 100644 --- a/src/storm/storage/BitVector.cpp +++ b/src/storm/storage/BitVector.cpp @@ -116,7 +116,10 @@ namespace storm { // Only perform the assignment if the source and target are not identical. if (this != &other) { bitCount = other.bitCount; - buckets = new uint64_t[other.bucketCount()]; + if (buckets && bucketCount() != other.bucketCount()) { + delete[] buckets; + buckets = new uint64_t[other.bucketCount()]; + } std::copy_n(other.buckets, other.bucketCount(), buckets); } return *this;