wined3d: Make sure b_info structure is properly allocated and released.
This commit is contained in:
parent
8904529dda
commit
f50bb771c9
|
@ -1269,6 +1269,9 @@ HRESULT WINAPI IWineD3DSurfaceImpl_GetDC(IWineD3DSurface *iface, HDC *pHDC) {
|
||||||
break;
|
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
|
/* 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,
|
* 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
|
* 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) {
|
if (!This->dib.DIBsection) {
|
||||||
ERR("CreateDIBSection failed!\n");
|
ERR("CreateDIBSection failed!\n");
|
||||||
|
HeapFree(GetProcessHeap(), 0, b_info);
|
||||||
return HRESULT_FROM_WIN32(GetLastError());
|
return HRESULT_FROM_WIN32(GetLastError());
|
||||||
}
|
}
|
||||||
HeapFree(GetProcessHeap(), 0, b_info);
|
|
||||||
|
|
||||||
TRACE("DIBSection at : %p\n", This->dib.bitmap_data);
|
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;
|
This->Flags |= SFLAG_GLDIRTY;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
HeapFree(GetProcessHeap(), 0, b_info);
|
||||||
|
|
||||||
/* Use the dib section from now on */
|
/* Use the dib section from now on */
|
||||||
This->resource.allocatedMemory = This->dib.bitmap_data;
|
This->resource.allocatedMemory = This->dib.bitmap_data;
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue