hhctrl.ocx: Fix a memory leak on an error path (Smatch).

Michael Stefaniuc mstefani at redhat.de
Wed Jul 1 17:32:31 CDT 2009


---
 dlls/hhctrl.ocx/chm.c |    4 +++-
 1 files changed, 3 insertions(+), 1 deletions(-)

diff --git a/dlls/hhctrl.ocx/chm.c b/dlls/hhctrl.ocx/chm.c
index c3a7499..b7df8e7 100644
--- a/dlls/hhctrl.ocx/chm.c
+++ b/dlls/hhctrl.ocx/chm.c
@@ -370,8 +370,10 @@ CHMInfo *OpenCHM(LPCWSTR szFile)
     if (!(ret = heap_alloc_zero(sizeof(CHMInfo))))
         return NULL;
 
-    if (!(ret->szFile = strdupW(szFile)))
+    if (!(ret->szFile = strdupW(szFile))) {
+        heap_free(ret);
         return NULL;
+    }
 
     hres = CoCreateInstance(&CLSID_ITStorage, NULL, CLSCTX_INPROC_SERVER,
             &IID_IITStorage, (void **) &ret->pITStorage) ;
-- 
1.6.3.3



More information about the wine-patches mailing list