oleaut32: Don't return bogus pointers if no data is available.
This commit is contained in:
parent
1a00e932ad
commit
5f85b7c8ac
|
@ -5330,9 +5330,12 @@ static HRESULT TLB_AllocAndInitFuncDesc( const FUNCDESC *src, FUNCDESC **dest_pt
|
||||||
dest->funckind = FUNC_DISPATCH;
|
dest->funckind = FUNC_DISPATCH;
|
||||||
buffer = (char *)(dest + 1);
|
buffer = (char *)(dest + 1);
|
||||||
|
|
||||||
dest->lprgscode = (SCODE *)buffer;
|
if (dest->cScodes) {
|
||||||
memcpy(dest->lprgscode, src->lprgscode, sizeof(*src->lprgscode) * src->cScodes);
|
dest->lprgscode = (SCODE *)buffer;
|
||||||
buffer += sizeof(*src->lprgscode) * src->cScodes;
|
memcpy(dest->lprgscode, src->lprgscode, sizeof(*src->lprgscode) * src->cScodes);
|
||||||
|
buffer += sizeof(*src->lprgscode) * src->cScodes;
|
||||||
|
} else
|
||||||
|
dest->lprgscode = NULL;
|
||||||
|
|
||||||
hr = TLB_CopyElemDesc(&src->elemdescFunc, &dest->elemdescFunc, &buffer);
|
hr = TLB_CopyElemDesc(&src->elemdescFunc, &dest->elemdescFunc, &buffer);
|
||||||
if (FAILED(hr))
|
if (FAILED(hr))
|
||||||
|
@ -5341,23 +5344,26 @@ static HRESULT TLB_AllocAndInitFuncDesc( const FUNCDESC *src, FUNCDESC **dest_pt
|
||||||
return hr;
|
return hr;
|
||||||
}
|
}
|
||||||
|
|
||||||
dest->lprgelemdescParam = (ELEMDESC *)buffer;
|
if (dest->cParams) {
|
||||||
buffer += sizeof(ELEMDESC) * src->cParams;
|
dest->lprgelemdescParam = (ELEMDESC *)buffer;
|
||||||
for (i = 0; i < src->cParams; i++)
|
buffer += sizeof(ELEMDESC) * src->cParams;
|
||||||
{
|
for (i = 0; i < src->cParams; i++)
|
||||||
hr = TLB_CopyElemDesc(&src->lprgelemdescParam[i], &dest->lprgelemdescParam[i], &buffer);
|
{
|
||||||
|
hr = TLB_CopyElemDesc(&src->lprgelemdescParam[i], &dest->lprgelemdescParam[i], &buffer);
|
||||||
|
if (FAILED(hr))
|
||||||
|
break;
|
||||||
|
}
|
||||||
if (FAILED(hr))
|
if (FAILED(hr))
|
||||||
break;
|
{
|
||||||
}
|
/* undo the above actions */
|
||||||
if (FAILED(hr))
|
for (i = i - 1; i >= 0; i--)
|
||||||
{
|
TLB_FreeElemDesc(&dest->lprgelemdescParam[i]);
|
||||||
/* undo the above actions */
|
TLB_FreeElemDesc(&dest->elemdescFunc);
|
||||||
for (i = i - 1; i >= 0; i--)
|
SysFreeString((BSTR)dest);
|
||||||
TLB_FreeElemDesc(&dest->lprgelemdescParam[i]);
|
return hr;
|
||||||
TLB_FreeElemDesc(&dest->elemdescFunc);
|
}
|
||||||
SysFreeString((BSTR)dest);
|
} else
|
||||||
return hr;
|
dest->lprgelemdescParam = NULL;
|
||||||
}
|
|
||||||
|
|
||||||
/* special treatment for dispinterfaces: this makes functions appear
|
/* special treatment for dispinterfaces: this makes functions appear
|
||||||
* to return their [retval] value when it is really returning an
|
* to return their [retval] value when it is really returning an
|
||||||
|
|
Loading…
Reference in New Issue