[PATCH 7/9] [Msi]: find_given_source

Eric Pouech eric.pouech at wanadoo.fr
Wed Nov 8 14:47:13 CST 2006


- fixed the key enumeration
  (spotted by valgrind)

A+
---

 dlls/msi/source.c |   17 +++++++++--------
 1 files changed, 9 insertions(+), 8 deletions(-)

diff --git a/dlls/msi/source.c b/dlls/msi/source.c
index 3b3e47f..654d397 100644
--- a/dlls/msi/source.c
+++ b/dlls/msi/source.c
@@ -131,17 +131,18 @@ static UINT find_given_source(HKEY key, 
         if (rc != ERROR_NO_MORE_ITEMS)
         {
             val = msi_alloc(val_size);
-            RegEnumValueW(key, index, szIndex, &size, NULL, NULL, (LPBYTE)val, 
-                &val_size);
-            if (lstrcmpiW(szSource,val)==0)
+            size = sizeof(szIndex)/sizeof(szIndex[0]);
+            rc = RegEnumValueW(key, index, szIndex, &size, NULL, NULL, (LPBYTE)val, 
+                               &val_size);
+            if (rc == ERROR_SUCCESS)
             {
-                ss->path = val;
                 strcpyW(ss->szIndex,szIndex);
-                break;
+                if (lstrcmpiW(szSource,val)==0)
+                {
+                    ss->path = val;
+                    break;
+                }
             }
-            else
-                strcpyW(ss->szIndex,szIndex);
-
             msi_free(val);
             index ++;
         }



More information about the wine-patches mailing list