Nigel Liang : winecfg: Fix crash when remove app button is pressed in applications tab.

Alexandre Julliard julliard at wine.codeweavers.com
Thu Aug 9 08:23:16 CDT 2007


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

Author: Nigel Liang <ncliang at gmail.com>
Date:   Wed Aug  8 18:07:05 2007 -0700

winecfg: Fix crash when remove app button is pressed in applications tab.

---

 programs/winecfg/winecfg.c |   11 +++++++----
 1 files changed, 7 insertions(+), 4 deletions(-)

diff --git a/programs/winecfg/winecfg.c b/programs/winecfg/winecfg.c
index 4c86514..342d1e8 100644
--- a/programs/winecfg/winecfg.c
+++ b/programs/winecfg/winecfg.c
@@ -467,13 +467,16 @@ static void set_reg_key_ex(HKEY root, const WCHAR *path, const WCHAR *name, cons
 
 void set_reg_key(HKEY root, const char *path, const char *name, const char *value)
 {
-    WCHAR *wpath, *wname, *wvalue = NULL;
+    WCHAR *wpath, *wname = NULL, *wvalue = NULL;
 
     wpath = HeapAlloc(GetProcessHeap(), 0, (strlen(path)+1)*sizeof(WCHAR));
-    wname = HeapAlloc(GetProcessHeap(), 0, (strlen(name)+1)*sizeof(WCHAR));
-
     MultiByteToWideChar(CP_ACP, 0, path, -1, wpath, strlen(path)+1);
-    MultiByteToWideChar(CP_ACP, 0, name, -1, wname, strlen(name)+1);
+
+    if (name)
+    {
+        wname = HeapAlloc(GetProcessHeap(), 0, (strlen(name)+1)*sizeof(WCHAR));
+        MultiByteToWideChar(CP_ACP, 0, name, -1, wname, strlen(name)+1);
+    }
 
     if (value)
     {




More information about the wine-cvs mailing list