Fix UI Server startup
authorAndre Heinecke <aheinecke@intevation.de>
Tue, 28 Jun 2016 08:47:38 +0000 (10:47 +0200)
committerAndre Heinecke <aheinecke@intevation.de>
Tue, 28 Jun 2016 08:50:09 +0000 (10:50 +0200)
* src/common.c (get_gpg4win_dir): Fix stupid logic error in loop.
Fix mem leak on error.
* src/engine-assuan.c (get_uiserver_name): Prefer 2.3.x names to
prefer the kleowrapped / gpgwrapped exectuables.

--
Thanks to rpr who reported this on the gpg4win message board.

src/common.c
src/engine-assuan.c

index b7b48b0..9b554b2 100644 (file)
@@ -1245,10 +1245,10 @@ get_gpg4win_dir()
   const char *g4win_keys[] = {GPG4WIN_REGKEY_3,
                               GPG4WIN_REGKEY_2,
                               NULL};
-  const char *key;
-  for (key = *g4win_keys; *key; key++)
+  const char **key;
+  for (key = g4win_keys; *key; key++)
     {
-      char *tmp = read_w32_registry_string (NULL, key, "Install Directory");
+      char *tmp = read_w32_registry_string (NULL, *key, "Install Directory");
       if (!tmp)
         {
           continue;
@@ -1257,6 +1257,11 @@ get_gpg4win_dir()
         {
           return tmp;
         }
+      else
+        {
+          log_debug ("Failed to access: %s\n", tmp);
+          xfree (tmp);
+        }
     }
   return NULL;
 }
index f2e0b09..32dbae8 100644 (file)
@@ -348,10 +348,10 @@ get_uiserver_name (void)
   char *dir, *uiserver, *p;
   int extra_arglen = 9;
 
-  const char * server_names[] = {"bin\\kleopatra.exe",
-                                 "kleopatra.exe",
-                                 "bin\\gpa.exe",
+  const char * server_names[] = {"kleopatra.exe",
+                                 "bin\\kleopatra.exe",
                                  "gpa.exe",
+                                 "bin\\gpa.exe",
                                  NULL};
   const char *tmp = NULL;