Commit 3ac34f74 authored by Vincent Povirk's avatar Vincent Povirk Committed by Alexandre Julliard

ole32: Properly free temporary objects when StorageBaseImpl_CopyTo fails.

parent 6afe24c3
...@@ -1690,17 +1690,17 @@ static HRESULT WINAPI StorageBaseImpl_CopyTo( ...@@ -1690,17 +1690,17 @@ static HRESULT WINAPI StorageBaseImpl_CopyTo(
NULL, 0, &pstgTmp ); NULL, 0, &pstgTmp );
} }
if (hr != S_OK) if (hr == S_OK)
goto cleanup; {
/*
* do the copy recursively
*/
hr = IStorage_CopyTo( pstgChild, ciidExclude, rgiidExclude,
NULL, pstgTmp );
/* IStorage_Release( pstgTmp );
* do the copy recursively }
*/
hr = IStorage_CopyTo( pstgChild, ciidExclude, rgiidExclude,
NULL, pstgTmp );
IStorage_Release( pstgTmp );
IStorage_Release( pstgChild ); IStorage_Release( pstgChild );
} }
else if (curElement.type == STGTY_STREAM) else if (curElement.type == STGTY_STREAM)
...@@ -1726,27 +1726,28 @@ static HRESULT WINAPI StorageBaseImpl_CopyTo( ...@@ -1726,27 +1726,28 @@ static HRESULT WINAPI StorageBaseImpl_CopyTo(
STGM_READ|STGM_SHARE_EXCLUSIVE, STGM_READ|STGM_SHARE_EXCLUSIVE,
0, &pstrChild ); 0, &pstrChild );
if (hr != S_OK) if (hr == S_OK)
goto cleanup; {
/*
* Get the size of the source stream
*/
IStream_Stat( pstrChild, &strStat, STATFLAG_NONAME );
/* /*
* Get the size of the source stream * Set the size of the destination stream.
*/ */
IStream_Stat( pstrChild, &strStat, STATFLAG_NONAME ); IStream_SetSize(pstrTmp, strStat.cbSize);
/* /*
* Set the size of the destination stream. * do the copy
*/ */
IStream_SetSize(pstrTmp, strStat.cbSize); hr = IStream_CopyTo( pstrChild, pstrTmp, strStat.cbSize,
NULL, NULL );
/* IStream_Release( pstrChild );
* do the copy }
*/
hr = IStream_CopyTo( pstrChild, pstrTmp, strStat.cbSize,
NULL, NULL );
IStream_Release( pstrTmp ); IStream_Release( pstrTmp );
IStream_Release( pstrChild );
} }
else else
{ {
......
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