Commit 0537454e authored by Vincent Povirk's avatar Vincent Povirk Committed by Alexandre Julliard

propsys: Fix memory leak in IPropertyStore::SetValue.

parent 15992994
......@@ -303,6 +303,7 @@ static HRESULT WINAPI PropertyStore_SetValue(IPropertyStoreCache *iface,
PropertyStore *This = impl_from_IPropertyStoreCache(iface);
propstore_value *value;
HRESULT hr;
PROPVARIANT temp;
TRACE("%p,%p,%p\n", iface, key, propvar);
......@@ -311,7 +312,13 @@ static HRESULT WINAPI PropertyStore_SetValue(IPropertyStoreCache *iface,
hr = PropertyStore_LookupValue(This, key, 1, &value);
if (SUCCEEDED(hr))
hr = PropVariantCopy(&value->propvar, propvar);
hr = PropVariantCopy(&temp, propvar);
if (SUCCEEDED(hr))
{
PropVariantClear(&value->propvar);
value->propvar = temp;
}
LeaveCriticalSection(&This->lock);
......@@ -405,6 +412,7 @@ static HRESULT WINAPI PropertyStore_SetValueAndState(IPropertyStoreCache *iface,
PropertyStore *This = impl_from_IPropertyStoreCache(iface);
propstore_value *value;
HRESULT hr;
PROPVARIANT temp;
TRACE("%p,%p,%p,%d\n", iface, key, ppropvar, state);
......@@ -413,10 +421,14 @@ static HRESULT WINAPI PropertyStore_SetValueAndState(IPropertyStoreCache *iface,
hr = PropertyStore_LookupValue(This, key, 1, &value);
if (SUCCEEDED(hr))
hr = PropVariantCopy(&value->propvar, ppropvar);
hr = PropVariantCopy(&temp, ppropvar);
if (SUCCEEDED(hr))
{
PropVariantClear(&value->propvar);
value->propvar = temp;
value->state = state;
}
LeaveCriticalSection(&This->lock);
......
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