more fixes and extending the tests coverage more fixes and hardening

* gentest.py testapi.c: more fixes and extending the tests coverage
* nanoftp.c xmlIO.c: more fixes and hardening
Daniel
diff --git a/nanoftp.c b/nanoftp.c
index 30d143f..0002226 100644
--- a/nanoftp.c
+++ b/nanoftp.c
@@ -703,11 +703,11 @@
     ret->controlFd = -1;
 
     unescaped = xmlURIUnescapeString(URL, 0, NULL);
-    if (unescaped != NULL)
+    if (unescaped != NULL) {
 	xmlNanoFTPScanURL(ret, unescaped);
-    else if (URL != NULL)
+	xmlFree(unescaped);
+    } else if (URL != NULL)
 	xmlNanoFTPScanURL(ret, URL);
-    xmlFree(unescaped);
 
     return(ret);
 }