Christian Costa : wined3d: Make sure b_info structure is properly allocated and released.

Alexandre Julliard julliard at wine.codeweavers.com
Thu Aug 17 05:04:36 CDT 2006


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

Author: Christian Costa <titan.costa at wanadoo.fr>
Date:   Wed Aug 16 22:35:58 2006 +0200

wined3d: Make sure b_info structure is properly allocated and released.

---

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

diff --git a/dlls/wined3d/surface.c b/dlls/wined3d/surface.c
index f7b73b6..0e0e6dd 100644
--- a/dlls/wined3d/surface.c
+++ b/dlls/wined3d/surface.c
@@ -1269,6 +1269,9 @@ HRESULT WINAPI IWineD3DSurfaceImpl_GetDC
                 break;
         }
 
+        if (!b_info)
+            return E_OUTOFMEMORY;
+
         /* Some apps access the surface in via DWORDs, and do not take the necessary care at the end of the
          * surface. So we need at least extra 4 bytes at the end of the surface. Check against the page size,
          * if the last page used for the surface has at least 4 spare bytes we're safe, otherwise
@@ -1347,9 +1350,9 @@ HRESULT WINAPI IWineD3DSurfaceImpl_GetDC
 
         if (!This->dib.DIBsection) {
             ERR("CreateDIBSection failed!\n");
+            HeapFree(GetProcessHeap(), 0, b_info);
             return HRESULT_FROM_WIN32(GetLastError());
         }
-        HeapFree(GetProcessHeap(), 0, b_info);
 
         TRACE("DIBSection at : %p\n", This->dib.bitmap_data);
 
@@ -1363,6 +1366,8 @@ HRESULT WINAPI IWineD3DSurfaceImpl_GetDC
             This->Flags |= SFLAG_GLDIRTY;
         }
 
+        HeapFree(GetProcessHeap(), 0, b_info);
+
         /* Use the dib section from now on */
         This->resource.allocatedMemory = This->dib.bitmap_data;
 




More information about the wine-cvs mailing list