[PATCH] msi/tests: Do not leak a HKEY in the failure codepath

Detlef Riekenberg wine.dev at web.de
Thu Oct 18 10:30:06 CDT 2007


---
 dlls/msi/tests/install.c |    8 ++++++--
 1 files changed, 6 insertions(+), 2 deletions(-)

diff --git a/dlls/msi/tests/install.c b/dlls/msi/tests/install.c
index b169886..c00b869 100644
--- a/dlls/msi/tests/install.c
+++ b/dlls/msi/tests/install.c
@@ -1006,12 +1006,16 @@ static BOOL get_program_files_dir(LPSTR 
         return FALSE;
 
     size = MAX_PATH;
-    if (RegQueryValueEx(hkey, "ProgramFilesDir", 0, &type, (LPBYTE)buf, &size))
+    if (RegQueryValueExA(hkey, "ProgramFilesDir", 0, &type, (LPBYTE)buf, &size)) {
+        RegCloseKey(hkey);
         return FALSE;
+    }
 
     size = MAX_PATH;
-    if (RegQueryValueEx(hkey, "CommonFilesDir", 0, &type, (LPBYTE)buf2, &size))
+    if (RegQueryValueExA(hkey, "CommonFilesDir", 0, &type, (LPBYTE)buf2, &size)) {
+        RegCloseKey(hkey);
         return FALSE;
+    }
 
     RegCloseKey(hkey);
     return TRUE;
-- 
1.4.1


--=-NSB7u/dlcgvGU2bW5cWz--




More information about the wine-patches mailing list