diff --git a/src/d_fft_fftsg.c b/src/d_fft_fftsg.c
index 22d14bc..04cd7aa 100644
--- a/src/d_fft_fftsg.c
+++ b/src/d_fft_fftsg.c
@@ -21,6 +21,8 @@ for another, more permissive-sounding copyright notice.  -MSP
 /* ---------- Pd interface to OOURA FFT; imitate Mayer API ---------- */
 #include "m_pd.h"
 
+#include <malloc.h>
+
 #ifdef HAVE_ALLOCA_H        /* ifdef nonsense to find include for alloca() */
 # include <alloca.h>        /* linux, mac, mingw, cygwin */
 #elif defined _MSC_VER
diff --git a/src/x_array.c b/src/x_array.c
index 6a9e2eb..1ee1694 100644
--- a/src/x_array.c
+++ b/src/x_array.c
@@ -16,6 +16,8 @@
 #endif
 extern t_pd *newest;    /* OK - this should go into a .h file now :) */
 
+#include <malloc.h>
+
 #ifdef HAVE_ALLOCA_H        /* ifdef nonsense to find include for alloca() */
 # include <alloca.h>        /* linux, mac, mingw, cygwin */
 #elif defined _MSC_VER
diff --git a/src/x_list.c b/src/x_list.c
index 8b84f18..b148dcc 100644
--- a/src/x_list.c
+++ b/src/x_list.c
@@ -5,6 +5,8 @@
 #include "m_pd.h"
 /* #include <string.h> */
 
+#include <malloc.h>
+
 #ifdef HAVE_ALLOCA_H        /* ifdef nonsense to find include for alloca() */
 # include <alloca.h>        /* linux, mac, mingw, cygwin */
 #elif defined _MSC_VER
diff --git a/src/x_text.c b/src/x_text.c
index 852dbc8..5df8bf8 100644
--- a/src/x_text.c
+++ b/src/x_text.c
@@ -19,6 +19,8 @@ moment it also defines "text" but it may later be better to split this off. */
 extern t_pd *newest;    /* OK - this should go into a .h file now :) */
 static t_class *text_define_class;
 
+#include <malloc.h>
+
 #ifdef HAVE_ALLOCA_H        /* ifdef nonsense to find include for alloca() */
 # include <alloca.h>        /* linux, mac, mingw, cygwin */
 #elif defined _MSC_VER

Add mingw patch for pure-data
Add mingw patch for pure-data
