diff --git a/lib/memdebug.h b/lib/memdebug.h
index 6c289bd4dfc2d58bacd49c1c0fa870f7d1ae7ad3..7b7b713e2a728dda7f794b341b4e48c995986e0f 100644
--- a/lib/memdebug.h
+++ b/lib/memdebug.h
@@ -70,6 +70,7 @@ int curl_fclose(FILE *file, int line, const char *source);
 
 #define socket(domain,type,protocol)\
  curl_socket(domain,type,protocol,__LINE__,__FILE__)
+#undef accept /* for those with accept as a macro */
 #define accept(sock,addr,len)\
  curl_accept(sock,addr,len,__LINE__,__FILE__)