=?UTF-8?Q?Andr=C3=A9=20Hentschel=20?=: msi: Check return value from MSIREG_OpenInstallProps (Coverity).

Alexandre Julliard julliard at winehq.org
Mon Jan 6 14:47:13 CST 2014


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

Author: André Hentschel <nerv at dawncrow.de>
Date:   Sat Jan  4 19:17:01 2014 +0100

msi: Check return value from MSIREG_OpenInstallProps (Coverity).

---

 dlls/msi/msi.c |   12 ++++++------
 1 files changed, 6 insertions(+), 6 deletions(-)

diff --git a/dlls/msi/msi.c b/dlls/msi/msi.c
index f8a1874..5b344ca 100644
--- a/dlls/msi/msi.c
+++ b/dlls/msi/msi.c
@@ -1138,8 +1138,6 @@ static UINT MSI_GetProductInfo(LPCWSTR szProduct, LPCWSTR szAttribute,
         context = MSIINSTALLCONTEXT_MACHINE;
     }
 
-    MSIREG_OpenInstallProps(szProduct, context, NULL, &userdata, FALSE);
-
     if (!strcmpW( szAttribute, INSTALLPROPERTY_HELPLINKW ) ||
         !strcmpW( szAttribute, INSTALLPROPERTY_HELPTELEPHONEW ) ||
         !strcmpW( szAttribute, INSTALLPROPERTY_INSTALLDATEW ) ||
@@ -1162,9 +1160,11 @@ static UINT MSI_GetProductInfo(LPCWSTR szProduct, LPCWSTR szAttribute,
             r = ERROR_UNKNOWN_PRODUCT;
             goto done;
         }
-
-        if (!userdata)
-            return ERROR_UNKNOWN_PROPERTY;
+        if (MSIREG_OpenInstallProps(szProduct, context, NULL, &userdata, FALSE))
+        {
+            r = ERROR_UNKNOWN_PROPERTY;
+            goto done;
+        }
 
         if (!strcmpW( szAttribute, INSTALLPROPERTY_INSTALLEDPRODUCTNAMEW ))
             szAttribute = display_name;
@@ -1174,6 +1174,7 @@ static UINT MSI_GetProductInfo(LPCWSTR szProduct, LPCWSTR szAttribute,
         val = msi_reg_get_value(userdata, szAttribute, &type);
         if (!val)
             val = empty;
+        RegCloseKey(userdata);
     }
     else if (!strcmpW( szAttribute, INSTALLPROPERTY_INSTANCETYPEW ) ||
              !strcmpW( szAttribute, INSTALLPROPERTY_TRANSFORMSW ) ||
@@ -1266,7 +1267,6 @@ static UINT MSI_GetProductInfo(LPCWSTR szProduct, LPCWSTR szAttribute,
 
 done:
     RegCloseKey(prodkey);
-    RegCloseKey(userdata);
     return r;
 }
 




More information about the wine-cvs mailing list