diff --git a/include/asterisk/compat.h b/include/asterisk/compat.h
index a9f032b3439b1650ad6a74598379b644a13b0f71..25476bc47dfe0dce2b34aed10b2c818aaf3111b6 100644
--- a/include/asterisk/compat.h
+++ b/include/asterisk/compat.h
@@ -53,7 +53,7 @@
 
 #ifdef HAVE_ALLOCA_H
 #include <alloca.h>    /* not necessarily present - could be in stdlib */
-#elif defined(HAVE_ALLOCA)
+#elif defined(HAVE_ALLOCA) && defined(__MINGW32__)
 #include <malloc.h>    /* see if it is here... */
 #endif