zoom: fix connect options (bad free)
[yaz-moved-to-github.git] / src / zoom-c.c
index 0bb0b3f..667edb3 100644 (file)
@@ -337,7 +337,7 @@ char **ZOOM_connection_get_databases(ZOOM_connection con, ZOOM_options options,
         if (cp)
             cp++;
     }
-    if (!cp)
+    if (!cp || !*cp)
         cp = "Default";
     nmem_strsplit(odr_getmem(odr), "+", cp,  &databaseNames, num);
     return databaseNames;
@@ -477,8 +477,9 @@ ZOOM_API(void)
         }
 
         if (remainder != c->host_port) {
+            remainder = xstrdup(remainder);
             xfree(c->host_port);
-            c->host_port = xstrdup(remainder);
+            c->host_port = remainder;
             /*printf("# reset hp='%s'\n", remainder);*/
         }
     }