[PATCH] winecfg: Fix crash when remove app button is pressed in applications tab

Nigel Liang ncliang at gmail.com
Wed Aug 8 20:07:05 CDT 2007


diff --git a/programs/winecfg/winecfg.c b/programs/winecfg/winecfg.c
index b80c992..cfc658c 100644
--- a/programs/winecfg/winecfg.c
+++ b/programs/winecfg/winecfg.c
@@ -508,13 +508,16 @@ void set_reg_key_ex(HKEY root, const WCH
 
 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)
     {
-- 
1.4.1




More information about the wine-patches mailing list