Commit 8226a187 authored by Matteo Bruni's avatar Matteo Bruni Committed by Alexandre Julliard

d3dx9: Don't call CoUninitialize if CoInitializeEx failed.

parent 244100f0
......@@ -1025,7 +1025,7 @@ HRESULT WINAPI D3DXLoadSurfaceFromFileInMemory(IDirect3DSurface9 *pDestSurface,
const RECT *pSrcRect, DWORD dwFilter, D3DCOLOR Colorkey, D3DXIMAGE_INFO *pSrcInfo)
{
D3DXIMAGE_INFO imginfo;
HRESULT hr;
HRESULT hr, com_init;
IWICImagingFactory *factory = NULL;
IWICBitmapDecoder *decoder;
......@@ -1078,7 +1078,7 @@ HRESULT WINAPI D3DXLoadSurfaceFromFileInMemory(IDirect3DSurface9 *pDestSurface,
if (imginfo.ImageFileFormat == D3DXIFF_DIB)
convert_dib_to_bmp((void**)&pSrcData, &SrcDataSize);
CoInitializeEx(NULL, COINIT_APARTMENTTHREADED);
com_init = CoInitializeEx(NULL, COINIT_APARTMENTTHREADED);
if (FAILED(CoCreateInstance(&CLSID_WICImagingFactory, NULL, CLSCTX_INPROC_SERVER, &IID_IWICImagingFactory, (void**)&factory)))
goto cleanup_err;
......@@ -1181,6 +1181,7 @@ cleanup_err:
if (factory)
IWICImagingFactory_Release(factory);
if (SUCCEEDED(com_init))
CoUninitialize();
if (imginfo.ImageFileFormat == D3DXIFF_DIB)
......
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