[Bf-blender-cvs] [0dbc906] master: Cleanup: make grumpy asan happy and do not use `new []` to allocate data freed by `free()`.

Bastien Montagne noreply at git.blender.org
Wed Apr 29 17:49:30 CEST 2015


Commit: 0dbc9060a69e4d64a01a6fefdabb78acc32fab95
Author: Bastien Montagne
Date:   Wed Apr 29 17:46:03 2015 +0200
Branches: master
https://developer.blender.org/rB0dbc9060a69e4d64a01a6fefdabb78acc32fab95

Cleanup: make grumpy asan happy and do not use `new []` to allocate data freed by `free()`.

Probably nothing crucial, but asan build would crash on that stupid glitch... Annoying.

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

M	source/blender/imbuf/intern/dds/DirectDrawSurface.cpp

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

diff --git a/source/blender/imbuf/intern/dds/DirectDrawSurface.cpp b/source/blender/imbuf/intern/dds/DirectDrawSurface.cpp
index 15c8d86..6bf8277 100644
--- a/source/blender/imbuf/intern/dds/DirectDrawSurface.cpp
+++ b/source/blender/imbuf/intern/dds/DirectDrawSurface.cpp
@@ -60,6 +60,7 @@
 #include <PixelFormat.h>
 
 #include <stdio.h> // printf
+#include <stdlib.h>  // malloc
 #include <math.h>  // sqrt
 #include <sys/types.h>
 
@@ -1147,7 +1148,7 @@ void* DirectDrawSurface::readData(uint &rsize)
 	uint size = stream.size - header_size;
 	rsize = size;
 
-	unsigned char *data = new unsigned char[size];
+	unsigned char *data = (unsigned char *)malloc(sizeof(*data) * size);
 
 	stream.seek(header_size);
 	mem_read(stream, data, size);




More information about the Bf-blender-cvs mailing list