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

André Hentschel nerv at dawncrow.de
Sun Oct 28 10:16:54 CDT 2012


CID 713651 & 713655
---
 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;
-- 
1.8.0



-- 

Best Regards, André Hentschel


More information about the wine-patches mailing list