Fixed GetDocumentation a little. When called from RegisterTypeLib it
was leaving the Doc entry uninitialised, leading to page fault when measuring it. Also ensure correct freeing of resources on failure.
This commit is contained in:
parent
b1c45b9424
commit
064972768d
|
@ -3186,6 +3186,8 @@ static HRESULT WINAPI ITypeLib2_fnGetTypeComp(
|
||||||
* and path, and the context identifier for the library Help topic in the Help
|
* and path, and the context identifier for the library Help topic in the Help
|
||||||
* file.
|
* file.
|
||||||
*
|
*
|
||||||
|
* On a successful return all non-null BSTR pointers will have been set,
|
||||||
|
* possibly to NULL.
|
||||||
*/
|
*/
|
||||||
static HRESULT WINAPI ITypeLib2_fnGetDocumentation(
|
static HRESULT WINAPI ITypeLib2_fnGetDocumentation(
|
||||||
ITypeLib2 *iface,
|
ITypeLib2 *iface,
|
||||||
|
@ -3209,32 +3211,36 @@ static HRESULT WINAPI ITypeLib2_fnGetDocumentation(
|
||||||
|
|
||||||
if(index<0)
|
if(index<0)
|
||||||
{
|
{
|
||||||
/* documentation for the typelib */
|
/* documentation for the typelib */
|
||||||
if(pBstrName && This->Name)
|
if(pBstrName)
|
||||||
{
|
{
|
||||||
*pBstrName = SysAllocString(This->Name);
|
if (This->Name)
|
||||||
|
if(!(*pBstrName = SysAllocString(This->Name))) goto memerr1;else;
|
||||||
if (!(*pBstrName)) return STG_E_INSUFFICIENTMEMORY;
|
else
|
||||||
}
|
*pBstrName = NULL;
|
||||||
if(pBstrDocString && This->DocString)
|
}
|
||||||
{
|
if(pBstrDocString)
|
||||||
*pBstrDocString = SysAllocString(This->DocString);
|
{
|
||||||
|
if (This->DocString)
|
||||||
if (!(*pBstrDocString)) return STG_E_INSUFFICIENTMEMORY;
|
if(!(*pBstrDocString = SysAllocString(This->DocString))) goto memerr2;else;
|
||||||
}
|
else if (This->Name)
|
||||||
|
if(!(*pBstrDocString = SysAllocString(This->Name))) goto memerr2;else;
|
||||||
if(pdwHelpContext)
|
else
|
||||||
{
|
*pBstrDocString = NULL;
|
||||||
|
}
|
||||||
|
if(pdwHelpContext)
|
||||||
|
{
|
||||||
*pdwHelpContext = This->dwHelpContext;
|
*pdwHelpContext = This->dwHelpContext;
|
||||||
}
|
}
|
||||||
if(pBstrHelpFile && This->HelpFile)
|
if(pBstrHelpFile)
|
||||||
{
|
{
|
||||||
*pBstrHelpFile = SysAllocString(This->HelpFile);
|
if (This->HelpFile)
|
||||||
|
if(!(*pBstrHelpFile = SysAllocString(This->HelpFile))) goto memerr3;else;
|
||||||
|
else
|
||||||
|
*pBstrHelpFile = NULL;
|
||||||
|
}
|
||||||
|
|
||||||
if (!(*pBstrHelpFile)) return STG_E_INSUFFICIENTMEMORY;
|
result = S_OK;
|
||||||
}
|
|
||||||
|
|
||||||
result = S_OK;
|
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
@ -3253,6 +3259,12 @@ static HRESULT WINAPI ITypeLib2_fnGetDocumentation(
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return result;
|
return result;
|
||||||
|
memerr3:
|
||||||
|
if (pBstrDocString) SysFreeString (*pBstrDocString);
|
||||||
|
memerr2:
|
||||||
|
if (pBstrName) SysFreeString (*pBstrName);
|
||||||
|
memerr1:
|
||||||
|
return STG_E_INSUFFICIENTMEMORY;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* ITypeLib::IsName
|
/* ITypeLib::IsName
|
||||||
|
|
Loading…
Reference in New Issue