diff --git a/src/atimer.c b/src/atimer.c
index 8253ae3a166..5bd282a310d 100644
--- a/src/atimer.c
+++ b/src/atimer.c
@@ -17,6 +17,7 @@
along with GNU Emacs. If not, see . */
#include
+#include "igc.h"
#ifdef WINDOWSNT
#define raise(s) w32_raise(s)
@@ -132,7 +133,13 @@ start_atimer (enum atimer_type type, struct timespec timestamp,
free_atimers = t->next;
}
else
- t = xmalloc (sizeof *t);
+ {
+#ifdef HAVE_MPS
+ t = igc_xzalloc_ambig (sizeof *t);
+#else
+ t = xmalloc (sizeof *t);
+#endif
+ }
/* Fill the atimer structure. */
memset (t, 0, sizeof *t);
diff --git a/src/pgtkterm.c b/src/pgtkterm.c
index ef940509626..c0ed68d6820 100644
--- a/src/pgtkterm.c
+++ b/src/pgtkterm.c
@@ -7166,7 +7166,11 @@ #define NUM_ARGV 10
if (ckd_add (&nbytes, SBYTES (Vinvocation_name), SBYTES (system_name) + 2))
memory_full (SIZE_MAX);
dpyinfo->x_id = ++x_display_id;
+#ifdef HAVE_MPS
+ dpyinfo->x_id_name = igc_xzalloc_ambig (nbytes);
+#else
dpyinfo->x_id_name = xmalloc (nbytes);
+#endif
char *nametail = lispstpcpy (dpyinfo->x_id_name, Vinvocation_name);
*nametail++ = '@';
lispstpcpy (nametail, system_name);
@@ -7302,7 +7306,14 @@ pgtk_delete_display (struct pgtk_display_info *dpyinfo)
}
pgtk_free_devices (dpyinfo);
+
+#ifdef HAVE_MPS
+ igc_xfree (dpyinfo->x_id_name);
+ igc_xfree (dpyinfo);
+#else
+ xfree (dpyinfo->x_id_name);
xfree (dpyinfo);
+#endif
}
char *