Commit 23f54c93 authored by Vincent Povirk's avatar Vincent Povirk Committed by Alexandre Julliard

setupapi: Add a matching CoUninitialize call.

Spotted by Rob Shearman.
parent a6ce819c
...@@ -789,6 +789,7 @@ static BOOL profile_items_callback( HINF hinf, PCWSTR field, void *arg ) ...@@ -789,6 +789,7 @@ static BOOL profile_items_callback( HINF hinf, PCWSTR field, void *arg )
INFCONTEXT name_context, context; INFCONTEXT name_context, context;
IShellLinkW* shelllink=NULL; IShellLinkW* shelllink=NULL;
IPersistFile* persistfile=NULL; IPersistFile* persistfile=NULL;
HRESULT initresult=E_FAIL;
int attrs=0; int attrs=0;
static const WCHAR dotlnk[] = {'.','l','n','k',0}; static const WCHAR dotlnk[] = {'.','l','n','k',0};
...@@ -864,7 +865,7 @@ static BOOL profile_items_callback( HINF hinf, PCWSTR field, void *arg ) ...@@ -864,7 +865,7 @@ static BOOL profile_items_callback( HINF hinf, PCWSTR field, void *arg )
if (!cmdline) return TRUE; if (!cmdline) return TRUE;
CoInitialize(NULL); initresult = CoInitialize(NULL);
if (!SUCCEEDED(CoCreateInstance( &CLSID_ShellLink, NULL, if (!SUCCEEDED(CoCreateInstance( &CLSID_ShellLink, NULL,
CLSCTX_INPROC_SERVER, &IID_IShellLinkW, (LPVOID*)&shelllink))) CLSCTX_INPROC_SERVER, &IID_IShellLinkW, (LPVOID*)&shelllink)))
...@@ -881,6 +882,7 @@ static BOOL profile_items_callback( HINF hinf, PCWSTR field, void *arg ) ...@@ -881,6 +882,7 @@ static BOOL profile_items_callback( HINF hinf, PCWSTR field, void *arg )
IShellLinkW_Release( shelllink ); IShellLinkW_Release( shelllink );
done: done:
if (SUCCEEDED(initresult)) CoUninitialize();
HeapFree( GetProcessHeap(), 0, cmdline ); HeapFree( GetProcessHeap(), 0, cmdline );
return TRUE; return TRUE;
} }
......
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