msi: Fix use of uninitialized variable (Coverity) (Try 2)

Andrew Talbot Andrew.Talbot at talbotville.com
Sat Jun 23 11:28:50 CDT 2007


This patch should fix Coverity bug CID-562.

-- Andy.
---
Changelog:
    msi: Fix use of uninitialized variable (Coverity).

diff -urN a/dlls/msi/action.c b/dlls/msi/action.c
--- a/dlls/msi/action.c	2007-06-18 17:52:27.000000000 +0100
+++ b/dlls/msi/action.c	2007-06-23 17:08:55.000000000 +0100
@@ -4648,7 +4648,7 @@
     LPWSTR deformatted, ptr;
     DWORD flags, type, size;
     LONG res;
-    HKEY env, root = HKEY_CURRENT_USER;
+    HKEY env = NULL, root = HKEY_CURRENT_USER;
 
     static const WCHAR environment[] =
         {'S','y','s','t','e','m','\\',
@@ -4759,7 +4759,7 @@
     res = RegSetValueExW(env, name, 0, type, (LPVOID)newval, size);
 
 done:
-    RegCloseKey(env);
+    if (env) RegCloseKey(env);
     msi_free(deformatted);
     msi_free(data);
     msi_free(newval);



More information about the wine-patches mailing list