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/xmlIO.c b/xmlIO.c
index f33d355..a0701e2 100644
--- a/xmlIO.c
+++ b/xmlIO.c
@@ -657,6 +657,9 @@
const char *path = NULL;
FILE *fd;
+ if (filename == NULL)
+ return(NULL);
+
if (!strcmp(filename, "-")) {
fd = stdin;
return((void *) fd);
@@ -704,13 +707,14 @@
xmlFileOpen (const char *filename) {
char *unescaped;
void *retval;
+
unescaped = xmlURIUnescapeString(filename, 0, NULL);
if (unescaped != NULL) {
retval = xmlFileOpen_real(unescaped);
+ xmlFree(unescaped);
} else {
retval = xmlFileOpen_real(filename);
}
- xmlFree(unescaped);
return retval;
}
@@ -813,6 +817,8 @@
FILE *fil;
int ret;
+ if (context == NULL)
+ return(-1);
fil = (FILE *) context;
if ((fil == stdout) || (fil == stderr)) {
ret = fflush(fil);
@@ -837,6 +843,9 @@
static int
xmlFileFlush (void * context) {
int ret;
+
+ if (context == NULL)
+ return(-1);
ret = ( fflush((FILE *) context) == EOF ) ? -1 : 0;
if (ret < 0)
xmlIOErr(0, "fflush()");