Michael Stefaniuc : itss: Reorder some code to avoid leaking memory on an error path.

Alexandre Julliard julliard at winehq.org
Wed Feb 10 10:44:51 CST 2010


Module: wine
Branch: master
Commit: 7a8638d8b32a84594aaebdb0ccf35677f1445fe2
URL:    http://source.winehq.org/git/wine.git/?a=commit;h=7a8638d8b32a84594aaebdb0ccf35677f1445fe2

Author: Michael Stefaniuc <mstefani at redhat.de>
Date:   Tue Feb  9 23:01:26 2010 +0100

itss: Reorder some code to avoid leaking memory on an error path.

Found by Smatch.

---

 dlls/itss/storage.c |    7 ++++---
 1 files changed, 4 insertions(+), 3 deletions(-)

diff --git a/dlls/itss/storage.c b/dlls/itss/storage.c
index fa92c4f..79c863a 100644
--- a/dlls/itss/storage.c
+++ b/dlls/itss/storage.c
@@ -399,6 +399,10 @@ static HRESULT WINAPI ITSS_IStorageImpl_OpenStorage(
     TRACE("%p %s %p %u %p %u %p\n", This, debugstr_w(pwcsName),
           pstgPriority, grfMode, snbExclude, reserved, ppstg);
 
+    chmfile = chm_dup( This->chmfile );
+    if( !chmfile )
+        return E_FAIL;
+
     len = strlenW( This->dir ) + strlenW( pwcsName ) + 1;
     path = HeapAlloc( GetProcessHeap(), 0, len*sizeof(WCHAR) );
     strcpyW( path, This->dir );
@@ -423,9 +427,6 @@ static HRESULT WINAPI ITSS_IStorageImpl_OpenStorage(
 
     TRACE("Resolving %s\n", debugstr_w(path));
 
-    chmfile = chm_dup( This->chmfile );
-    if( !chmfile )
-        return E_FAIL;
     return ITSS_create_chm_storage(chmfile, path, ppstg);
 }
 




More information about the wine-cvs mailing list