Commit 1752f364 authored by Misha Koshelev's avatar Misha Koshelev Committed by Alexandre Julliard

msi/tests: automation: Free memory after string conversion.

parent 804d0139
......@@ -334,16 +334,19 @@ static DISPID get_dispid( IDispatch *disp, const char *name )
{
LPOLESTR str;
UINT len;
DISPID id;
DISPID id = -1;
HRESULT r;
len = MultiByteToWideChar(CP_ACP, 0, name, -1, NULL, 0 );
str = HeapAlloc(GetProcessHeap(), 0, len*sizeof(WCHAR) );
len = MultiByteToWideChar(CP_ACP, 0, name, -1, str, len );
r = IDispatch_GetIDsOfNames( disp, &IID_NULL, &str, 1, 0, &id );
if (r != S_OK)
return -1;
if (str)
{
len = MultiByteToWideChar(CP_ACP, 0, name, -1, str, len );
r = IDispatch_GetIDsOfNames( disp, &IID_NULL, &str, 1, 0, &id );
HeapFree(GetProcessHeap(), 0, str);
if (r != S_OK)
return -1;
}
return id;
}
......
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