[Bf-blender-cvs] [020a9e8] opensubdiv-modifier: Fix memory leak around source config

Sergey Sharybin noreply at git.blender.org
Mon May 12 20:08:58 CEST 2014


Commit: 020a9e8b7dba0c3d81d08995e3c88c5b50c3ba83
Author: Sergey Sharybin
Date:   Sun May 11 13:51:04 2014 +0200
https://developer.blender.org/rB020a9e8b7dba0c3d81d08995e3c88c5b50c3ba83

Fix memory leak around source config

There are also some other leaks happening in OpenSubdiv,
for until fixes are merged to upstream consider using

  https://github.com/Nazg-Gul/OpenSubdiv

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

M	intern/opensubdiv/opensubdiv_capi.cc
M	intern/opensubdiv/opensubdiv_gpu_capi.cc

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

diff --git a/intern/opensubdiv/opensubdiv_capi.cc b/intern/opensubdiv/opensubdiv_capi.cc
index b062e46..6c7a9f1 100644
--- a/intern/opensubdiv/opensubdiv_capi.cc
+++ b/intern/opensubdiv/opensubdiv_capi.cc
@@ -26,18 +26,22 @@
 
 #include "opensubdiv_capi.h"
 
-#include <opensubdiv/osd/cpuComputeController.h>
 #include <opensubdiv/osd/glMesh.h>
-
-#include <opensubdiv/osd/cudaGLVertexBuffer.h>
-#include <opensubdiv/osd/cudaComputeContext.h>
-#include <opensubdiv/osd/cudaComputeController.h>
 #include <opensubdiv/osd/glDrawRegistry.h>
-
 #include <opensubdiv/osdutil/evaluator_capi.h>
 #include <opensubdiv/osdutil/topology.h>
 #include <opensubdiv/osdutil/mesh.h>
 
+// CPU Backend
+#include <opensubdiv/osd/cpuGLVertexBuffer.h>
+#include <opensubdiv/osd/cpuComputeContext.h>
+#include <opensubdiv/osd/cpuComputeController.h>
+
+// CUDA backend
+#include <opensubdiv/osd/cudaGLVertexBuffer.h>
+#include <opensubdiv/osd/cudaComputeContext.h>
+#include <opensubdiv/osd/cudaComputeController.h>
+
 #include "cudaInit.h"
 
 #include "MEM_guardedalloc.h"
@@ -52,6 +56,11 @@ using OpenSubdiv::OsdMeshBitset;
 using OpenSubdiv::OsdUtilSubdivTopology;
 using OpenSubdiv::OsdVertex;
 
+// CPU backend
+using OpenSubdiv::OsdCpuGLVertexBuffer;
+using OpenSubdiv::OsdCpuComputeController;
+
+// CUDA backend
 using OpenSubdiv::OsdCudaComputeController;
 using OpenSubdiv::OsdCudaGLVertexBuffer;
 
diff --git a/intern/opensubdiv/opensubdiv_gpu_capi.cc b/intern/opensubdiv/opensubdiv_gpu_capi.cc
index 0b77d42..4a5a378 100644
--- a/intern/opensubdiv/opensubdiv_gpu_capi.cc
+++ b/intern/opensubdiv/opensubdiv_gpu_capi.cc
@@ -226,6 +226,7 @@ EffectDrawRegistry::_CreateDrawConfig(DescType const &desc,
                                       SourceConfigType const *sconfig)
 {
 	ConfigType *config = BaseRegistry::_CreateDrawConfig(desc, sconfig);
+	delete sconfig;
 	assert(config);
 
 	GLuint uboIndex;




More information about the Bf-blender-cvs mailing list