Vincent Povirk : ole32: Properly free temporary objects when StorageBaseImpl_CopyTo fails.
Alexandre Julliard
julliard at winehq.org
Mon Dec 14 09:51:16 CST 2009
Module: wine
Branch: master
Commit: 3ac34f7416ff660a62abacee9d9bff7cc72d5339
URL: http://source.winehq.org/git/wine.git/?a=commit;h=3ac34f7416ff660a62abacee9d9bff7cc72d5339
Author: Vincent Povirk <vincent at codeweavers.com>
Date: Sun Dec 13 18:30:35 2009 -0600
ole32: Properly free temporary objects when StorageBaseImpl_CopyTo fails.
---
dlls/ole32/storage32.c | 51 ++++++++++++++++++++++++-----------------------
1 files changed, 26 insertions(+), 25 deletions(-)
diff --git a/dlls/ole32/storage32.c b/dlls/ole32/storage32.c
index 2d2c3d6..90d2434 100644
--- a/dlls/ole32/storage32.c
+++ b/dlls/ole32/storage32.c
@@ -1690,17 +1690,17 @@ static HRESULT WINAPI StorageBaseImpl_CopyTo(
NULL, 0, &pstgTmp );
}
- if (hr != S_OK)
- goto cleanup;
-
+ if (hr == S_OK)
+ {
+ /*
+ * do the copy recursively
+ */
+ hr = IStorage_CopyTo( pstgChild, ciidExclude, rgiidExclude,
+ NULL, pstgTmp );
- /*
- * do the copy recursively
- */
- hr = IStorage_CopyTo( pstgChild, ciidExclude, rgiidExclude,
- NULL, pstgTmp );
+ IStorage_Release( pstgTmp );
+ }
- IStorage_Release( pstgTmp );
IStorage_Release( pstgChild );
}
else if (curElement.type == STGTY_STREAM)
@@ -1726,27 +1726,28 @@ static HRESULT WINAPI StorageBaseImpl_CopyTo(
STGM_READ|STGM_SHARE_EXCLUSIVE,
0, &pstrChild );
- if (hr != S_OK)
- goto cleanup;
+ if (hr == S_OK)
+ {
+ /*
+ * Get the size of the source stream
+ */
+ IStream_Stat( pstrChild, &strStat, STATFLAG_NONAME );
- /*
- * Get the size of the source stream
- */
- IStream_Stat( pstrChild, &strStat, STATFLAG_NONAME );
+ /*
+ * Set the size of the destination stream.
+ */
+ IStream_SetSize(pstrTmp, strStat.cbSize);
- /*
- * Set the size of the destination stream.
- */
- IStream_SetSize(pstrTmp, strStat.cbSize);
+ /*
+ * do the copy
+ */
+ hr = IStream_CopyTo( pstrChild, pstrTmp, strStat.cbSize,
+ NULL, NULL );
- /*
- * do the copy
- */
- hr = IStream_CopyTo( pstrChild, pstrTmp, strStat.cbSize,
- NULL, NULL );
+ IStream_Release( pstrChild );
+ }
IStream_Release( pstrTmp );
- IStream_Release( pstrChild );
}
else
{
More information about the wine-cvs
mailing list