ole32: Avoid erroneously freeing a variable in ReadFmtUserTypeStg

Frédéric Delanoy frederic.delanoy at gmail.com
Sat Nov 10 03:33:49 CST 2012


On success, szCLSIDName shouldn't be freed (caller is responsible for this).
---
 dlls/ole32/storage32.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/dlls/ole32/storage32.c b/dlls/ole32/storage32.c
index 8498eaf..2e0f264 100644
--- a/dlls/ole32/storage32.c
+++ b/dlls/ole32/storage32.c
@@ -8774,7 +8774,8 @@ HRESULT WINAPI ReadFmtUserTypeStg (LPSTORAGE pstg, CLIPFORMAT* pcf, LPOLESTR* lp
         *lplpszUserType = szCLSIDName;
 
 end:
-    CoTaskMemFree( szCLSIDName );
+    if ( !lplpszUserType || FAILED( r ) )
+        CoTaskMemFree( szCLSIDName );
     CoTaskMemFree( szOleTypeName );
     CoTaskMemFree( szProgIDName );
     IStream_Release( stm );
-- 
1.8.0




More information about the wine-patches mailing list