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:
authorAntony Riakiotakis <kalast@gmail.com>2012-05-22 21:33:58 +0400
committerAntony Riakiotakis <kalast@gmail.com>2012-05-22 21:33:58 +0400
commit931146731d896a20b15e1fe847479025b2922db5 (patch)
tree09c0066ff3cb3a18693509bfe4fbfd7f8ff7911d /source/blender
parentf16f545c6e78f8d677408b566dd2001dbb90e7f8 (diff)
Fix memory leak when deleting all vertices from mesh with certain modifiers (bevel and array among them) and VBO are enabled.
Diffstat (limited to 'source/blender')
-rw-r--r--source/blender/gpu/intern/gpu_buffers.c8
1 files changed, 7 insertions, 1 deletions
diff --git a/source/blender/gpu/intern/gpu_buffers.c b/source/blender/gpu/intern/gpu_buffers.c
index 833aefc20aa..6da7d9e10e3 100644
--- a/source/blender/gpu/intern/gpu_buffers.c
+++ b/source/blender/gpu/intern/gpu_buffers.c
@@ -102,7 +102,7 @@ static GPUBufferPool *gpu_buffer_pool_new(void)
if (useVBOs == -1)
useVBOs = (GLEW_ARB_vertex_buffer_object ? 1 : 0);
- pool = MEM_callocN(sizeof(GPUBufferPool), "GPUBuffer");
+ pool = MEM_callocN(sizeof(GPUBufferPool), "GPUBuffer_Pool");
pool->maxsize = MAX_FREE_GPU_BUFFERS;
pool->buffers = MEM_callocN(sizeof(GPUBuffer *) * pool->maxsize,
@@ -192,6 +192,12 @@ GPUBuffer *GPU_buffer_alloc(int size)
GPUBuffer *buf;
int i, bufsize, bestfit = -1;
+ /* bad case, leads to leak of buf since buf->pointer will allocate
+ * NULL, leading to return without cleanup. In any case better detect early
+ * psy-fi */
+ if(size == 0)
+ return NULL;
+
pool = gpu_get_global_buffer_pool();
/* not sure if this buffer pool code has been profiled much,