Commit f50bb771 authored by Christian Costa's avatar Christian Costa Committed by Alexandre Julliard

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

parent 8904529d
......@@ -1269,6 +1269,9 @@ HRESULT WINAPI IWineD3DSurfaceImpl_GetDC(IWineD3DSurface *iface, HDC *pHDC) {
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(IWineD3DSurface *iface, HDC *pHDC) {
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(IWineD3DSurface *iface, HDC *pHDC) {
This->Flags |= SFLAG_GLDIRTY;
}
HeapFree(GetProcessHeap(), 0, b_info);
/* Use the dib section from now on */
This->resource.allocatedMemory = This->dib.bitmap_data;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment