Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJacques Lucke <jacques@blender.org>2022-02-02 15:11:33 +0300
committerJacques Lucke <jacques@blender.org>2022-02-02 15:11:33 +0300
commitbf8597febe2020e654020ad60e8af35c635c1a9a (patch)
treea55a1cb1b4a1268b6a11ebdde228b1a031a90042 /source/blender/blenlib/BLI_vector_set.hh
parenta985f558a6eb16cd6f00b550712b86923ab33fd3 (diff)
BLI: fix memory leak in VectorSet
The leak happened when the vector set had to grow when it was empty but it had allocated the keys array already.
Diffstat (limited to 'source/blender/blenlib/BLI_vector_set.hh')
-rw-r--r--source/blender/blenlib/BLI_vector_set.hh4
1 files changed, 4 insertions, 0 deletions
diff --git a/source/blender/blenlib/BLI_vector_set.hh b/source/blender/blenlib/BLI_vector_set.hh
index 0aac96f93bc..ed744d09314 100644
--- a/source/blender/blenlib/BLI_vector_set.hh
+++ b/source/blender/blenlib/BLI_vector_set.hh
@@ -570,6 +570,10 @@ class VectorSet {
if (this->size() == 0) {
try {
slots_.reinitialize(total_slots);
+ if (keys_ != nullptr) {
+ this->deallocate_keys_array(keys_);
+ keys_ = nullptr;
+ }
keys_ = this->allocate_keys_array(usable_slots);
}
catch (...) {