d3dx9_36/tests: Replace a malloc() with HeapAlloc()+HeapFree().
fgouget at free.fr
Wed Mar 16 02:57:16 CDT 2011
dlls/d3dx9_36/tests/mesh.c | 3 ++-
1 files changed, 2 insertions(+), 1 deletions(-)
Any reason why we were not freeing glyphmetrics_float? I can understand
that this is a short lived executable but not freeing is annoying when
tests are run in Valgrind and freeing would also in effect document tha
the content of this variable is not used outside of test_createtext().
Furthermore this function is called multiple times which makes not
freeing even more ugly imho.
Also all I can say about the correctness of this patch is that on my PC
the test fails in the same way after this patch as before :-(.
diff --git a/dlls/d3dx9_36/tests/mesh.c b/dlls/d3dx9_36/tests/mesh.c
index 6f79192..07fe2435 100644
@@ -2852,7 +2852,7 @@ static void test_createtext(IDirect3DDevice9 *device, HDC hdc, LPCSTR text, FLOA
- GLYPHMETRICSFLOAT *glyphmetrics_float = malloc(sizeof(GLYPHMETRICSFLOAT) * strlen(text));
+ GLYPHMETRICSFLOAT *glyphmetrics_float = HeapAlloc(GetProcessHeap(), 0, sizeof(GLYPHMETRICSFLOAT) * strlen(text));
HFONT font = NULL, oldfont = NULL;
@@ -2913,6 +2913,7 @@ static void test_createtext(IDirect3DDevice9 *device, HDC hdc, LPCSTR text, FLOA
+ HeapFree(GetProcessHeap(), 0, glyphmetrics_float);
static void D3DXCreateTextTest(void)
More information about the wine-patches