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:
authorSybren A. Stüvel <sybren@stuvel.eu>2018-07-05 13:21:33 +0300
committerSybren A. Stüvel <sybren@stuvel.eu>2018-07-05 13:22:55 +0300
commit03ef9f32148acb45c4940cf93d7d8afb850231d0 (patch)
treea17cec429b99fb427ad05a7072e87bc3fe2b8542
parentf4ce6d02cde816c3c681702d97a75617b8e9a598 (diff)
Fluidsim: fixed memory leak
-rw-r--r--source/blender/modifiers/intern/MOD_fluidsim.c19
1 files changed, 14 insertions, 5 deletions
diff --git a/source/blender/modifiers/intern/MOD_fluidsim.c b/source/blender/modifiers/intern/MOD_fluidsim.c
index bb87d0065fe..ebea7250d18 100644
--- a/source/blender/modifiers/intern/MOD_fluidsim.c
+++ b/source/blender/modifiers/intern/MOD_fluidsim.c
@@ -69,11 +69,20 @@ static void copyData(const ModifierData *md, ModifierData *target, const int UNU
const FluidsimModifierData *fluidmd = (const FluidsimModifierData *) md;
FluidsimModifierData *tfluidmd = (FluidsimModifierData *) target;
- if (fluidmd->fss) {
- tfluidmd->fss = MEM_dupallocN(fluidmd->fss);
- if (tfluidmd->fss && (tfluidmd->fss->meshVelocities != NULL)) {
- tfluidmd->fss->meshVelocities = MEM_dupallocN(tfluidmd->fss->meshVelocities);
- }
+ /* Free any FSS that was allocated in initData() */
+ if (tfluidmd->fss) {
+ MEM_SAFE_FREE(tfluidmd->fss->meshVelocities);
+ MEM_freeN(tfluidmd->fss);
+ }
+
+ if (fluidmd->fss == NULL) {
+ tfluidmd->fss = NULL;
+ return;
+ }
+
+ tfluidmd->fss = MEM_dupallocN(fluidmd->fss);
+ if (tfluidmd->fss->meshVelocities != NULL) {
+ tfluidmd->fss->meshVelocities = MEM_dupallocN(tfluidmd->fss->meshVelocities);
}
}