diff --git a/ares/ares_init.c b/ares/ares_init.c
index bd29fe94f49eb9a0b514c101ac6f9aef86b32672..5117dfa539b61ec0564aa9474e2bc23224399a95 100644
--- a/ares/ares_init.c
+++ b/ares/ares_init.c
@@ -119,7 +119,7 @@ int ares_init_options(ares_channel *channelptr, struct ares_options *options,
   struct server_state *server;
   struct timeval now;
 
-#ifdef CURLDEBUG
+#ifdef DEBUGBUILD
   const char *env = getenv("CARES_MEMDEBUG");
 
   if (env)
diff --git a/ares/ares_private.h b/ares/ares_private.h
index c84a1d0b33519d2076b16c953e39ab3c34cef42e..f1b80995bec624fd046d501d11537c53ff9064ae 100644
--- a/ares/ares_private.h
+++ b/ares/ares_private.h
@@ -337,7 +337,7 @@ long ares__tvdiff(struct timeval t1, struct timeval t2);
       (c)->sock_state_cb((c)->sock_state_cb_data, (s), (r), (w));       \
   } while (0)
 
-#ifdef CURLDEBUG
+#ifdef DEBUGBUILD
 /* This is low-level hard-hacking memory leak tracking and similar. Using the
    libcurl lowlevel code from within library is ugly and only works when
    c-ares is built and linked with a similarly debug-build libcurl, but we do