Commit: 5f95ffe35034120189340cd413f24979da92109e
Author: Sergey Sharybin
Date:   Wed Jul 27 10:59:09 2016 +0200
Branches: master
https://developer.blender.org/rB5f95ffe35034120189340cd413f24979da92109e

Fix T48829: Memory leak on Blender Exit

It was possible to have missing outlink but GPUNodes in material.

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

M       source/blender/gpu/intern/gpu_codegen.c
M       source/blender/gpu/intern/gpu_codegen.h
M       source/blender/gpu/intern/gpu_material.c

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

diff --git a/source/blender/gpu/intern/gpu_codegen.c 
b/source/blender/gpu/intern/gpu_codegen.c
index aec94f9..c40bc8e 100644
--- a/source/blender/gpu/intern/gpu_codegen.c
+++ b/source/blender/gpu/intern/gpu_codegen.c
@@ -1732,3 +1732,9 @@ void GPU_pass_free(GPUPass *pass)
                MEM_freeN(pass->vertexcode);
        MEM_freeN(pass);
 }
+
+void GPU_pass_free_nodes(ListBase *nodes)
+{
+       gpu_nodes_free(nodes);
+}
+
diff --git a/source/blender/gpu/intern/gpu_codegen.h 
b/source/blender/gpu/intern/gpu_codegen.h
index 417e46a..7af17f9 100644
--- a/source/blender/gpu/intern/gpu_codegen.h
+++ b/source/blender/gpu/intern/gpu_codegen.h
@@ -183,6 +183,7 @@ void GPU_pass_update_uniforms(GPUPass *pass);
 void GPU_pass_unbind(GPUPass *pass);
 
 void GPU_pass_free(GPUPass *pass);
+void GPU_pass_free_nodes(ListBase *nodes);
 
 void gpu_codegen_init(void);
 void gpu_codegen_exit(void);
diff --git a/source/blender/gpu/intern/gpu_material.c 
b/source/blender/gpu/intern/gpu_material.c
index 4775d2e..ed9718f 100644
--- a/source/blender/gpu/intern/gpu_material.c
+++ b/source/blender/gpu/intern/gpu_material.c
@@ -270,6 +270,9 @@ static int GPU_material_construct_end(GPUMaterial 
*material, const char *passnam
                        material->partangvel = GPU_shader_get_uniform(shader, 
GPU_builtin_name(GPU_PARTICLE_ANG_VELOCITY));
                return 1;
        }
+       else {
+               GPU_pass_free_nodes(&material->nodes);
+       }
 
        return 0;
 }

_______________________________________________
Bf-blender-cvs mailing list
[email protected]
https://lists.blender.org/mailman/listinfo/bf-blender-cvs

Reply via email to