=?UTF-8?Q?Andr=C3=A9=20Hentschel=20?=: oleaut32: Don' t leak memory allocated by heap_alloc_zero (coverity).

Alexandre Julliard julliard at winehq.org
Mon Oct 29 13:52:50 CDT 2012


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

Author: André Hentschel <nerv at dawncrow.de>
Date:   Sun Oct 28 16:16:54 2012 +0100

oleaut32: Don't leak memory allocated by heap_alloc_zero (coverity).

---

 dlls/oleaut32/typelib.c  |    9 +++++----
 dlls/oleaut32/typelib2.c |    3 ++-
 2 files changed, 7 insertions(+), 5 deletions(-)

diff --git a/dlls/oleaut32/typelib.c b/dlls/oleaut32/typelib.c
index 7700121..3d94164 100644
--- a/dlls/oleaut32/typelib.c
+++ b/dlls/oleaut32/typelib.c
@@ -4070,10 +4070,10 @@ static ITypeLib2* ITypeLib2_Constructor_SLTG(LPVOID pLib, DWORD dwTLBLength)
       SLTG_TypeInfoTail *pTITail;
       SLTG_MemberHeader *pMemHeader;
 
-      if(strcmp(pBlkEntry[order].index_string + (char*)pMagic,
-		pOtherTypeInfoBlks[i].index_name)) {
-	FIXME_(typelib)("Index strings don't match\n");
-	return NULL;
+      if(strcmp(pBlkEntry[order].index_string + (char*)pMagic, pOtherTypeInfoBlks[i].index_name)) {
+        FIXME_(typelib)("Index strings don't match\n");
+        heap_free(pOtherTypeInfoBlks);
+        return NULL;
       }
 
       pTIHeader = pBlk;
@@ -4189,6 +4189,7 @@ static ITypeLib2* ITypeLib2_Constructor_SLTG(LPVOID pLib, DWORD dwTLBLength)
 
     if(i != pTypeLibImpl->TypeInfoCount) {
       FIXME("Somehow processed %d TypeInfos\n", i);
+      heap_free(pOtherTypeInfoBlks);
       return NULL;
     }
 
diff --git a/dlls/oleaut32/typelib2.c b/dlls/oleaut32/typelib2.c
index 8ea95fe..689d9af 100644
--- a/dlls/oleaut32/typelib2.c
+++ b/dlls/oleaut32/typelib2.c
@@ -5272,7 +5272,8 @@ static ICreateTypeLib2 *ICreateTypeLib2_Constructor(SYSKIND syskind, LPCOLESTR f
 
     if (failed) {
         ICreateTypeLib2_fnRelease(&create_tlib2->ICreateTypeLib2_iface);
-	return NULL;
+        heap_free(create_tlib2);
+        return NULL;
     }
 
     return &create_tlib2->ICreateTypeLib2_iface;




More information about the wine-cvs mailing list