diff --git a/hash.c b/hash.c
index 0145109..282cec3 100644
--- a/hash.c
+++ b/hash.c
@@ -984,6 +984,8 @@ xmlHashCopy(xmlHashTablePtr table, xmlHashCopier f) {
 	return(NULL);
 
     ret = xmlHashCreate(table->size);
+    if (ret == NULL)
+	return(NULL);
     if (table->table) {
 	for(i = 0; i < table->size; i++) {
 	    if (table->table[i].valid == 0)
diff --git a/nanoftp.c b/nanoftp.c
index ab1f685..3b421bf 100644
--- a/nanoftp.c
+++ b/nanoftp.c
@@ -1244,6 +1244,8 @@ xmlNanoFTPConnectTo(const char *server, int port) {
     if (port <= 0)
 	return(NULL);
     ctxt = (xmlNanoFTPCtxtPtr) xmlNanoFTPNewCtxt(NULL);
+    if (ctxt == NULL)
+	return(NULL);
     ctxt->hostname = xmlMemStrdup(server);
     if (port != 0)
 	ctxt->port = port;
@@ -1322,7 +1324,6 @@ xmlNanoFTPDele(void *ctx, const char *file) {
     int res;
 
     if ((ctxt == NULL) || (ctxt->controlFd == INVALID_SOCKET) || (file == NULL)) return(-1);
-    if (file == NULL) return (0);
 
     /*
      * Expected response code for DELE:
diff --git a/nanohttp.c b/nanohttp.c
index e9859a6..fa23a5e 100644
--- a/nanohttp.c
+++ b/nanohttp.c
@@ -1365,15 +1365,15 @@ xmlNanoHTTPMethodRedir(const char *URL, const char *method, const char *input,
 retry:
     if (redirURL == NULL)
 	ctxt = xmlNanoHTTPNewCtxt(URL);
+    if (ctxt == NULL) 
+	return (NULL);
     else {
 	ctxt = xmlNanoHTTPNewCtxt(redirURL);
+	if (ctxt == NULL) 
+	    return (NULL);
 	ctxt->location = xmlMemStrdup(redirURL);
     }
 
-    if ( ctxt == NULL ) {
-	return ( NULL );
-    }
-
     if ((ctxt->protocol == NULL) || (strcmp(ctxt->protocol, "http"))) {
 	__xmlIOErr(XML_FROM_HTTP, XML_HTTP_URL_SYNTAX, "Not a valid HTTP URI");
         xmlNanoHTTPFreeCtxt(ctxt);
