Henri Verbeet : wined3d: Don't leak heapMemory in surface_remove_pbo().

Alexandre Julliard julliard at winehq.org
Wed Dec 8 10:56:23 CST 2010


Module: wine
Branch: master
Commit: 46f3cc9df640c7d8eb33fffe035bc3ebf1424735
URL:    http://source.winehq.org/git/wine.git/?a=commit;h=46f3cc9df640c7d8eb33fffe035bc3ebf1424735

Author: Henri Verbeet <hverbeet at codeweavers.com>
Date:   Tue Dec  7 18:47:05 2010 +0100

wined3d: Don't leak heapMemory in surface_remove_pbo().

---

 dlls/wined3d/surface.c |    9 ++++++---
 1 files changed, 6 insertions(+), 3 deletions(-)

diff --git a/dlls/wined3d/surface.c b/dlls/wined3d/surface.c
index c54f6ae..f7f0679 100644
--- a/dlls/wined3d/surface.c
+++ b/dlls/wined3d/surface.c
@@ -1119,9 +1119,12 @@ static void WINAPI IWineD3DSurfaceImpl_PreLoad(IWineD3DSurface *iface)
 /* Context activation is done by the caller. */
 static void surface_remove_pbo(IWineD3DSurfaceImpl *This, const struct wined3d_gl_info *gl_info)
 {
-    This->resource.heapMemory = HeapAlloc(GetProcessHeap() ,0 , This->resource.size + RESOURCE_ALIGNMENT);
-    This->resource.allocatedMemory =
-            (BYTE *)(((ULONG_PTR) This->resource.heapMemory + (RESOURCE_ALIGNMENT - 1)) & ~(RESOURCE_ALIGNMENT - 1));
+    if (!This->resource.heapMemory)
+    {
+        This->resource.heapMemory = HeapAlloc(GetProcessHeap(), 0, This->resource.size + RESOURCE_ALIGNMENT);
+        This->resource.allocatedMemory =
+                (BYTE *)(((ULONG_PTR)This->resource.heapMemory + (RESOURCE_ALIGNMENT - 1)) & ~(RESOURCE_ALIGNMENT - 1));
+    }
 
     ENTER_GL();
     GL_EXTCALL(glBindBufferARB(GL_PIXEL_UNPACK_BUFFER_ARB, This->pbo));




More information about the wine-cvs mailing list