[Bf-blender-cvs] [41495707d20] master: Fix incorrect destruction of Outliner tree-elements

Julian Eisel noreply at git.blender.org
Fri Jan 14 19:28:31 CET 2022


Commit: 41495707d207db94db238e0bce5bd2dd90cbdbef
Author: Julian Eisel
Date:   Fri Jan 14 19:08:02 2022 +0100
Branches: master
https://developer.blender.org/rB41495707d207db94db238e0bce5bd2dd90cbdbef

Fix incorrect destruction of Outliner tree-elements

`TreeElement` isn't a trivial type anymore, so `MEM_delete()` should be
called, which calls the destructor.
AFAICS this would cause a memory leak, since the contained `unique_ptr`
is allocated but not destructed correctly - but it's not using the
guarded allocator so woudn't be reported.

===================================================================

M	source/blender/editors/space_outliner/outliner_tree.cc

===================================================================

diff --git a/source/blender/editors/space_outliner/outliner_tree.cc b/source/blender/editors/space_outliner/outliner_tree.cc
index 5f378a02052..92e12756b16 100644
--- a/source/blender/editors/space_outliner/outliner_tree.cc
+++ b/source/blender/editors/space_outliner/outliner_tree.cc
@@ -218,7 +218,7 @@ void outliner_free_tree_element(TreeElement *element, ListBase *parent_subtree)
     MEM_freeN((void *)element->name);
   }
   element->type = nullptr;
-  MEM_freeN(element);
+  MEM_delete(element);
 }
 
 /* ********************************************************* */



More information about the Bf-blender-cvs mailing list