Re: gameux/gamestatistics.c: Make sure each VARIANT is cleared after use (valgrind)
Joris Huizer <joris_huizer(a)yahoo.com> writes:
@@ -511,24 +511,27 @@ static HRESULT GAMEUX_loadStatisticsFromFile(struct GAMEUX_STATS *data)
if(SUCCEEDED(hr)) { - hr = IXMLDOMElement_getAttribute(categoryElement, bstrIndex, &vValue); - if( hr == S_OK && V_VT(&vValue) != VT_BSTR) + VARIANT categoryIndex, categoryName; + hr = IXMLDOMElement_getAttribute(categoryElement, bstrIndex, &categoryIndex); + if( hr == S_OK && V_VT(&categoryIndex) != VT_BSTR) hr = E_FAIL;
if(SUCCEEDED(hr)) { - i = StrToIntW(V_BSTR(&vValue)); - hr = IXMLDOMElement_getAttribute(categoryElement, bstrName, &vValue); - if( hr == S_OK && V_VT(&vValue) != VT_BSTR) + i = StrToIntW(V_BSTR(&categoryIndex)); + hr = IXMLDOMElement_getAttribute(categoryElement, bstrName, &categoryName); + if( hr == S_OK && V_VT(&categoryName) != VT_BSTR) hr = E_FAIL; } + VariantClear(&categoryIndex);
You should only clear it when it has been successfully set. -- Alexandre Julliard julliard(a)winehq.org
participants (1)
-
Alexandre Julliard