1
0
mirror of https://github.com/FunkyFr3sh/cnc-ddraw.git synced 2025-03-24 17:49:52 +01:00

Use HeapFree to free heaps, incorrectly used std free

Convert last malloc/free to HeapAlloc/HeapFree
This commit is contained in:
Toni Spets 2010-11-16 17:32:31 +02:00
parent fdf8395dd1
commit afdc334935
4 changed files with 5 additions and 6 deletions

View File

@ -41,7 +41,7 @@ ULONG __stdcall ddraw_clipper_Release(IDirectDrawClipperImpl *This)
if(This->Ref == 0) if(This->Ref == 0)
{ {
free(This); HeapFree(GetProcessHeap(), 0, This);
return 0; return 0;
} }

View File

@ -64,7 +64,7 @@ ULONG __stdcall ddraw_palette_Release(IDirectDrawPaletteImpl *This)
if(This->Ref == 0) if(This->Ref == 0)
{ {
free(This); HeapFree(GetProcessHeap(), 0, This);
return 0; return 0;
} }

View File

@ -129,11 +129,10 @@ DWORD WINAPI render_main(void)
SetEvent(ddraw->render.ev); SetEvent(ddraw->render.ev);
} }
HeapFree(GetProcessHeap(), 0, tex);
CloseHandle(ddraw->render.ev); CloseHandle(ddraw->render.ev);
ddraw->render.ev = NULL; ddraw->render.ev = NULL;
free(tex);
wglMakeCurrent(NULL, NULL); wglMakeCurrent(NULL, NULL);
wglDeleteContext(hRC); wglDeleteContext(hRC);
ReleaseDC(ddraw->hWnd, hDC); ReleaseDC(ddraw->hWnd, hDC);

View File

@ -52,7 +52,7 @@ ULONG __stdcall ddraw_surface_Release(IDirectDrawSurfaceImpl *This)
} }
if(This->surface) if(This->surface)
{ {
free(This->surface); HeapFree(GetProcessHeap(), 0, This->surface);
} }
if(This->palette) if(This->palette)
{ {
@ -433,7 +433,7 @@ HRESULT __stdcall ddraw_CreateSurface(IDirectDrawImpl *This, LPDDSURFACEDESC lpD
{ {
Surface->lPitch = Surface->width; Surface->lPitch = Surface->width;
Surface->lXPitch = Surface->bpp / 8; Surface->lXPitch = Surface->bpp / 8;
Surface->surface = malloc(Surface->width * Surface->height * Surface->lXPitch); Surface->surface = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, Surface->width * Surface->height * Surface->lXPitch);
} }
printf(" Surface = %p (%dx%d@%d)\n", Surface, (int)Surface->width, (int)Surface->height, (int)Surface->bpp); printf(" Surface = %p (%dx%d@%d)\n", Surface, (int)Surface->width, (int)Surface->height, (int)Surface->bpp);