If SafeArrayGetElement is called on a variant array, initialize

destination variant before copying the array element to it, some badly
behaved apps don't seem to do it themselves.
This commit is contained in:
Ove Kaaven 2002-01-02 21:44:49 +00:00 committed by Alexandre Julliard
parent a0da66945f
commit fbdfef73f6
1 changed files with 3 additions and 1 deletions

View File

@ -356,7 +356,9 @@ HRESULT WINAPI SafeArrayGetElement(
*((BSTR*)pv) = pbstrReturnedStr;
}
else if( psa->fFeatures == FADF_VARIANT) {
HRESULT hr = VariantCopy(pv, elementStorageAddress);
HRESULT hr;
VariantInit(pv);
hr = VariantCopy(pv, elementStorageAddress);
if (FAILED(hr)) {
SafeArrayUnlock(psa);
return hr;