Nikolay Sivov : oleaut32: Always free TLIBATTR in LoadRegTypeLib() ( Valgrind).

Alexandre Julliard julliard at winehq.org
Mon Apr 28 13:27:00 CDT 2014


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

Author: Nikolay Sivov <nsivov at codeweavers.com>
Date:   Sat Apr 26 00:37:15 2014 +0400

oleaut32: Always free TLIBATTR in LoadRegTypeLib() (Valgrind).

---

 dlls/oleaut32/typelib.c |   13 +++++++++----
 1 file changed, 9 insertions(+), 4 deletions(-)

diff --git a/dlls/oleaut32/typelib.c b/dlls/oleaut32/typelib.c
index 4213ae6..4a16fca 100644
--- a/dlls/oleaut32/typelib.c
+++ b/dlls/oleaut32/typelib.c
@@ -542,12 +542,17 @@ HRESULT WINAPI LoadRegTypeLib(
             TLIBATTR *attr;
 
             res = ITypeLib_GetLibAttr(*ppTLib, &attr);
-            if (res == S_OK && (attr->wMajorVerNum != wVerMajor || attr->wMinorVerNum < wVerMinor))
+            if (res == S_OK)
             {
+                BOOL mismatch = attr->wMajorVerNum != wVerMajor || attr->wMinorVerNum < wVerMinor;
                 ITypeLib_ReleaseTLibAttr(*ppTLib, attr);
-                ITypeLib_Release(*ppTLib);
-                *ppTLib = NULL;
-                res = TYPE_E_LIBNOTREGISTERED;
+
+                if (mismatch)
+                {
+                    ITypeLib_Release(*ppTLib);
+                    *ppTLib = NULL;
+                    res = TYPE_E_LIBNOTREGISTERED;
+                }
             }
         }
     }




More information about the wine-cvs mailing list