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:
authorBastien Montagne <montagne29@wanadoo.fr>2018-05-16 18:35:54 +0300
committerBastien Montagne <montagne29@wanadoo.fr>2018-05-16 18:35:54 +0300
commit5308e31e419cf80b73df2d39e218d95164287ac4 (patch)
tree10926b2988902a0755ebbaec23c3fabf51bf7aa0 /source/blender/blenkernel
parent48645e55e1af069e0e7c2a5029a732be334c1dbd (diff)
Fix memleak with meshes having IDProps in modifier stack evaluation.
*Always* use BKE_library API to handle IDs allocation and freeing, unless you have a very, very, very good reason not to do so - and perfectly know what you are doing.
Diffstat (limited to 'source/blender/blenkernel')
-rw-r--r--source/blender/blenkernel/intern/DerivedMesh.c9
1 files changed, 6 insertions, 3 deletions
diff --git a/source/blender/blenkernel/intern/DerivedMesh.c b/source/blender/blenkernel/intern/DerivedMesh.c
index 6486e3312b5..abbfa4b7ff1 100644
--- a/source/blender/blenkernel/intern/DerivedMesh.c
+++ b/source/blender/blenkernel/intern/DerivedMesh.c
@@ -2329,8 +2329,8 @@ static void mesh_calc_modifiers(
if (new_mesh) {
/* if the modifier returned a new mesh, release the old one */
if (mesh && mesh != new_mesh) {
- BKE_mesh_free(mesh);
- MEM_freeN(mesh);
+ BLI_assert(mesh != me);
+ BKE_id_free(NULL, mesh);
}
mesh = new_mesh;
@@ -2360,6 +2360,7 @@ static void mesh_calc_modifiers(
if (new_mesh) {
/* if the modifier returned a new mesh, release the old one */
if (orco_mesh && orco_mesh != new_mesh) {
+ BLI_assert(orco_mesh != me);
BKE_id_free(NULL, orco_mesh);
}
@@ -2369,8 +2370,9 @@ static void mesh_calc_modifiers(
/* create cloth orco mesh in parallel */
if (nextmask & CD_MASK_CLOTH_ORCO) {
- if (!cloth_orco_mesh)
+ if (!cloth_orco_mesh) {
cloth_orco_mesh = create_orco_mesh(ob, me, NULL, CD_CLOTH_ORCO);
+ }
nextmask &= ~CD_MASK_CLOTH_ORCO;
mesh_set_only_copy(cloth_orco_mesh, nextmask | CD_MASK_ORIGINDEX);
@@ -2381,6 +2383,7 @@ static void mesh_calc_modifiers(
if (new_mesh) {
/* if the modifier returned a new mesh, release the old one */
if (cloth_orco_mesh && cloth_orco_mesh != new_mesh) {
+ BLI_assert(orco_mesh != me);
BKE_id_free(NULL, cloth_orco_mesh);
}