diff --git a/lib/formdata.c b/lib/formdata.c
index 76798616acf8fb2531099b9121b24b60b72530f9..9ac805bb0012dae09272752256149aea49707dd1 100644
--- a/lib/formdata.c
+++ b/lib/formdata.c
@@ -124,7 +124,7 @@ Content-Disposition: form-data; name="FILECONTENT"
 #include "strequal.h"
 
 /* The last #include file should be: */
-#ifdef MALLOCDEBUG
+#ifdef CURLDEBUG
 #include "memdebug.h"
 #endif
 
diff --git a/lib/getenv.c b/lib/getenv.c
index f5459072cbe4cdbb4e0790f332f754d8b0b114b1..09749fde5d67d0b6d5e105c4d6f7e7fdf5e42d1e 100644
--- a/lib/getenv.c
+++ b/lib/getenv.c
@@ -35,7 +35,7 @@
 #include <unixlib.h>
 #endif
 
-#ifdef MALLOCDEBUG
+#ifdef CURLDEBUG
 #include "memdebug.h"
 #endif
 
diff --git a/lib/getinfo.c b/lib/getinfo.c
index 28975aa949400bcbb6e700584ff013e499f6daa8..9bd737020ebdd0852b53fabe2782af2dbe2b938e 100644
--- a/lib/getinfo.c
+++ b/lib/getinfo.c
@@ -36,7 +36,7 @@
 #endif
 
 /* Make this the last #include */
-#ifdef MALLOCDEBUG
+#ifdef CURLDEBUG
 #include "memdebug.h"
 #else
 #include <stdlib.h>
diff --git a/lib/getpass.c b/lib/getpass.c
index b6ea97805fd8254bbdd17b756e98e083071b7d47..5886748b71197e922e6e176d7c11e3164af8f05e 100644
--- a/lib/getpass.c
+++ b/lib/getpass.c
@@ -89,7 +89,7 @@ char *getpass_r(const char *prompt, char *buffer, size_t buflen)
 #endif
 
 /* The last #include file should be: */
-#ifdef MALLOCDEBUG
+#ifdef CURLDEBUG
 #include "memdebug.h"
 #endif
 
diff --git a/lib/hash.c b/lib/hash.c
index cd6d5d53923a68eeb0374b39bc7c02391ec73c42..7310aba5ace739a801f76a66fa2ac9997063fe95 100644
--- a/lib/hash.c
+++ b/lib/hash.c
@@ -29,7 +29,7 @@
 #include "hash.h"
 #include "llist.h"
 
-#ifdef MALLOCDEBUG
+#ifdef CURLDEBUG
 /* this must be the last include file */
 #include "memdebug.h"
 #endif
diff --git a/lib/hostip.c b/lib/hostip.c
index c245ab1b765a8398ac65f4d1227212e5bbf338ab..5be36a6fa2787fb47c285cefe8fb294a96f1cd0a 100644
--- a/lib/hostip.c
+++ b/lib/hostip.c
@@ -74,7 +74,7 @@
 #endif
 
 /* The last #include file should be: */
-#ifdef MALLOCDEBUG
+#ifdef CURLDEBUG
 #include "memdebug.h"
 #endif
 
@@ -192,7 +192,7 @@ hostcache_prune(curl_hash *hostcache, int cache_timeout, int now)
                                  hostcache_timestamp_remove);
 }
 
-#if defined(MALLOCDEBUG) && defined(AGGRESIVE_TEST)
+#if defined(CURLDEBUG) && defined(AGGRESIVE_TEST)
 /* Called from Curl_done() to check that there's no DNS cache entry with
    a non-zero counter left. */
 void Curl_scan_cache_used(void *user, void *ptr)
@@ -282,7 +282,7 @@ struct Curl_dns_entry *Curl_resolv(struct SessionHandle *data,
 
   dns->timestamp = now;
   dns->inuse++;         /* mark entry as in-use */
-#ifdef MALLOCDEBUG
+#ifdef CURLDEBUG
   dns->entry_id = entry_id;
 #endif
 
@@ -337,7 +337,7 @@ void Curl_freednsinfo(void *freethis)
 
 #ifdef ENABLE_IPV6
 
-#ifdef MALLOCDEBUG
+#ifdef CURLDEBUG
 /* These two are strictly for memory tracing and are using the same
  * style as the family otherwise present in memdebug.c. I put these ones
  * here since they require a bunch of struct types I didn't wanna include
@@ -631,7 +631,7 @@ static Curl_addrinfo *my_getaddrinfo(struct SessionHandle *data,
       step_size+=200;
     }
 
-#ifdef MALLOCDEBUG
+#ifdef CURLDEBUG
     infof(data, "gethostbyname_r() uses %d bytes\n", step_size);
 #endif
 
@@ -681,7 +681,7 @@ static Curl_addrinfo *my_getaddrinfo(struct SessionHandle *data,
     if(!h) /* failure */
       res=1;
     
-#ifdef MALLOCDEBUG
+#ifdef CURLDEBUG
     infof(data, "gethostbyname_r() uses %d bytes\n", step_size);
 #endif
     if(!res) {
diff --git a/lib/hostip.h b/lib/hostip.h
index d07b75e3de7a296ab8bfecf8b49b92e3d8576376..36828ee1b169a22835db3f238557b4d48c5efc1a 100644
--- a/lib/hostip.h
+++ b/lib/hostip.h
@@ -41,7 +41,7 @@ struct Curl_dns_entry {
   time_t timestamp;
   long inuse;      /* use-counter, make very sure you decrease this
                       when you're done using the address you received */
-#ifdef MALLOCDEBUG
+#ifdef CURLDEBUG
   char *entry_id;
 #endif
 };
@@ -70,7 +70,7 @@ void Curl_freeaddrinfo(Curl_addrinfo *freeaddr);
 /* free cached name info */
 void Curl_freednsinfo(void *freethis);
 
-#ifdef MALLOCDEBUG
+#ifdef CURLDEBUG
 void curl_freeaddrinfo(struct addrinfo *freethis,
                        int line, const char *source);
 int curl_getaddrinfo(char *hostname, char *service,
diff --git a/lib/http_chunks.c b/lib/http_chunks.c
index 90f891f3103e153339df60fbd74b39fbe6ac40e6..b0309fec896d460474076efab4b4e4c1b687dde4 100644
--- a/lib/http_chunks.c
+++ b/lib/http_chunks.c
@@ -39,7 +39,7 @@
 #include <curl/mprintf.h>
 
 /* The last #include file should be: */
-#ifdef MALLOCDEBUG
+#ifdef CURLDEBUG
 #include "memdebug.h"
 #endif
 
diff --git a/lib/http_digest.c b/lib/http_digest.c
index 7f62c26b4b12e751c4e40123f279d7a0aa2f8405..51bcb8450e90494f3a0d60e22118e49d516a641c 100644
--- a/lib/http_digest.c
+++ b/lib/http_digest.c
@@ -41,7 +41,7 @@
 #include <curl/mprintf.h>
 
 /* The last #include file should be: */
-#ifdef MALLOCDEBUG
+#ifdef CURLDEBUG
 #include "memdebug.h"
 #endif
 
@@ -106,6 +106,9 @@ CURLdigest Curl_input_digest(struct connectdata *conn,
         /* allow the list to be comma-separated */
         header++; 
     }
+
+    if(!data->state.digest.nonce)
+      return CURLDIGEST_BAD;
   }
   else 
     /* else not a digest, get out */
diff --git a/lib/if2ip.c b/lib/if2ip.c
index d4cfa51810d7e5c4099301e5bd3060ac88ec74ae..07f30986bbe68fee2630c8961f843e08d6509369 100644
--- a/lib/if2ip.c
+++ b/lib/if2ip.c
@@ -73,7 +73,7 @@
 #endif
 
 /* The last #include file should be: */
-#ifdef MALLOCDEBUG
+#ifdef CURLDEBUG
 #include "memdebug.h"
 #endif
 
diff --git a/lib/krb4.c b/lib/krb4.c
index cb4fbc0d2292c547356f35a9a3c6e4b004c636b2..6c91e2fb945ad1886e50d59db78a42a7b09ddf3b 100644
--- a/lib/krb4.c
+++ b/lib/krb4.c
@@ -64,7 +64,7 @@
 #endif
 
 /* The last #include file should be: */
-#ifdef MALLOCDEBUG
+#ifdef CURLDEBUG
 #include "memdebug.h"
 #endif
 
diff --git a/lib/llist.c b/lib/llist.c
index ceee9e822aeffa758e5ed4a0e589c3f924b122df..9e38f67666ce00b356b931a9434175618fe7c3e2 100644
--- a/lib/llist.c
+++ b/lib/llist.c
@@ -28,7 +28,7 @@
 
 #include "llist.h"
 
-#ifdef MALLOCDEBUG
+#ifdef CURLDEBUG
 /* this must be the last include file */
 #include "memdebug.h"
 #endif
diff --git a/lib/memdebug.c b/lib/memdebug.c
index c0629691078af8aeeca77596a31464440265d5dd..d159fa0f3c5d646d37bbd25e165b26b79db93246 100644
--- a/lib/memdebug.c
+++ b/lib/memdebug.c
@@ -1,4 +1,4 @@
-#ifdef MALLOCDEBUG
+#ifdef CURLDEBUG
 /***************************************************************************
  *                                  _   _ ____  _     
  *  Project                     ___| | | |  _ \| |    
@@ -220,4 +220,4 @@ int curl_fclose(FILE *file, int line, const char *source)
 #ifdef VMS
 int VOID_VAR_MEMDEBUG;	
 #endif
-#endif /* MALLOCDEBUG */
+#endif /* CURLDEBUG */
diff --git a/lib/mprintf.c b/lib/mprintf.c
index 08a98c7962fa61958a7e3904e2acb8c50ffe21a8..b51e883f137d688e792837a298a38179cf6df20f 100644
--- a/lib/mprintf.c
+++ b/lib/mprintf.c
@@ -48,7 +48,7 @@
 
 
 /* The last #include file should be: */
-#ifdef MALLOCDEBUG
+#ifdef CURLDEBUG
 #include "memdebug.h"
 #endif
 
diff --git a/lib/multi.c b/lib/multi.c
index 3dfccd028044f7a31b5e1e6895e3bdde5f66262d..651a47d1b74a6bdc77eee2c117fdf204390c46fc 100644
--- a/lib/multi.c
+++ b/lib/multi.c
@@ -44,7 +44,7 @@
 #include "progress.h"
 
 /* The last #include file should be: */
-#ifdef MALLOCDEBUG
+#ifdef CURLDEBUG
 #include "memdebug.h"
 #endif
 
@@ -302,7 +302,7 @@ CURLMcode curl_multi_perform(CURLM *multi_handle, int *running_handles)
   easy=multi->easy.next;
   while(easy) {
 
-#ifdef MALLOCDEBUG
+#ifdef CURLDEBUG
     fprintf(stderr, "HANDLE %p: State: %x\n",
             (char *)easy, easy->state);
 #endif
diff --git a/lib/netrc.c b/lib/netrc.c
index 0c0db6e113cb354dd58f344c8a31a62d1b396f02..e152633444a96fd1195cb1d72d0833295bf24057 100644
--- a/lib/netrc.c
+++ b/lib/netrc.c
@@ -46,7 +46,7 @@
 #include "strtok.h"
 
 /* The last #include file should be: */
-#ifdef MALLOCDEBUG
+#ifdef CURLDEBUG
 #include "memdebug.h"
 #endif
 
@@ -119,7 +119,7 @@ int Curl_parsenetrc(char *host,
 
   sprintf(netrcbuffer, "%s%s%s", home, DIR_CHAR, NETRC);
 
-#ifdef MALLOCDEBUG
+#ifdef CURLDEBUG
   {
     /* This is a hack to allow testing.
      * If compiled with --enable-debug and CURL_DEBUG_NETRC is defined,
@@ -141,7 +141,7 @@ int Curl_parsenetrc(char *host,
       free(override);
     }
   }
-#endif /* MALLOCDEBUG */
+#endif /* CURLDEBUG */
 
   file = fopen(netrcbuffer, "r");
   if(file) {
diff --git a/lib/security.c b/lib/security.c
index 079975154c588da975e6aaaf5548a88c7ade78eb..1c83a18f9b4034b418e178e5877ebb5c2d541aaf 100644
--- a/lib/security.c
+++ b/lib/security.c
@@ -60,7 +60,7 @@
 #include "ftp.h"
 
 /* The last #include file should be: */
-#ifdef MALLOCDEBUG
+#ifdef CURLDEBUG
 #include "memdebug.h"
 #endif
 
diff --git a/lib/sendf.c b/lib/sendf.c
index efb89f2057261b5cf2c7a4cde9ecd508c0c3f07c..e4983fa682d5d7ce750514981002ef259e924a47 100644
--- a/lib/sendf.c
+++ b/lib/sendf.c
@@ -56,7 +56,7 @@
 #endif
 #include <string.h>
 /* The last #include file should be: */
-#ifdef MALLOCDEBUG
+#ifdef CURLDEBUG
 #include "memdebug.h"
 #endif
 
diff --git a/lib/ssluse.c b/lib/ssluse.c
index d520a2b54c5a7a5008f518c9961cc2838c68e939..b4af2ba0d72e8a7b58830b4ef5b1e3edf8443537 100644
--- a/lib/ssluse.c
+++ b/lib/ssluse.c
@@ -46,7 +46,7 @@
 #include <openssl/rand.h>
 
 /* The last #include file should be: */
-#ifdef MALLOCDEBUG
+#ifdef CURLDEBUG
 #include "memdebug.h"
 #endif
 
diff --git a/lib/telnet.c b/lib/telnet.c
index c1cc07d088b381211da5da0b01981418ef2edbee..e345caaa356f165513e6ef2d941cbc18403cf538 100644
--- a/lib/telnet.c
+++ b/lib/telnet.c
@@ -84,7 +84,7 @@
 #include "arpa_telnet.h"
 
 /* The last #include file should be: */
-#ifdef MALLOCDEBUG
+#ifdef CURLDEBUG
 #include "memdebug.h"
 #endif