diff --git a/src/modules/Image/encodings/ilbm.c b/src/modules/Image/encodings/ilbm.c
index 4a7bf1c155b97cc04b759fb6a4720b1a421f0ec9..b268472688708a32164649a2f4fa2de98e069644 100644
--- a/src/modules/Image/encodings/ilbm.c
+++ b/src/modules/Image/encodings/ilbm.c
@@ -697,7 +697,7 @@ static struct pike_string *make_body(struct BMHD *bmhd,
   unsigned int x, y;
   int rbyt = ((bmhd->w+15)&~15)>>3;
   int eplanes = (bmhd->masking == mskHasMask? bmhd->nPlanes+1:bmhd->nPlanes);
-  unsigned char *line = alloca(rbyt*eplanes);
+  unsigned char *line = xcalloc(rbyt, eplanes);
   INT32 *cptr, *cline = alloca((rbyt<<3)*sizeof(INT32));
   rgb_group *src = img->img;
   struct string_builder bldr;
@@ -710,7 +710,6 @@ static struct pike_string *make_body(struct BMHD *bmhd,
     ctfunc = image_colortable_index_32bit_function(ctable);
   }
 
-  memset(line, 0, rbyt*eplanes);
   init_string_builder(&bldr, 0);
   for(y=0; y<bmhd->h; y++) {
     if(ctfunc != NULL) {
@@ -732,6 +731,7 @@ static struct pike_string *make_body(struct BMHD *bmhd,
   }
   if(ctable != NULL)
     image_colortable_free_dither(&dith);
+  free(line);
   return finish_string_builder(&bldr);
 }
 
diff --git a/src/modules/Math/transforms.cmod b/src/modules/Math/transforms.cmod
index 70c133b38806dd0a7e22d3de86f3620feb8621d9..4854ef5ad17913fd910fa2b339dc00145b06c64a 100644
--- a/src/modules/Math/transforms.cmod
+++ b/src/modules/Math/transforms.cmod
@@ -177,8 +177,9 @@ PIKECLASS FFT
       p = myarray->item[1].u.array;
       n = r->size;
 
-      THIS->r_in = malloc(sizeof(fftw_real)*n);
-      memset(THIS->r_in,0,sizeof(fftw_real)*n);
+      free(THIS->r_in);
+      THIS->r_in = NULL; /* Needs to be NULL if xcalloc throws */
+      THIS->r_in = xcalloc(sizeof(fftw_real), n);
 
       for(i=0; i<=n/2; i++)
 	{
@@ -198,9 +199,9 @@ PIKECLASS FFT
 	  else Pike_error("Invalid type in array!\n");
 	}
 
-
-      THIS->r_out = malloc(sizeof(fftw_real)*n);
-      memset(THIS->r_out,0,sizeof(fftw_real)*n);
+      free(THIS->r_out);
+      THIS->r_out = NULL; /* Needs to be NULL if xcalloc throws */
+      THIS->r_out = xcalloc(sizeof(fftw_real), n);
 
       if (THIS->r_cr_plan_size!=n)
 	{
@@ -283,10 +284,8 @@ PIKECLASS FFT
 	rfftw_destroy_plan(THIS->r_cr_plan);
       if (THIS->r_rc_plan_size>0)
 	rfftw_destroy_plan(THIS->r_rc_plan);
-      if (THIS->r_out!=NULL)
-	free(THIS->r_out);
-      if (THIS->r_in!=NULL)
-	free(THIS->r_in);
+      free(THIS->r_out);
+      free(THIS->r_in);
     }
 }
 
diff --git a/src/modules/_Charset/charsetmod.c b/src/modules/_Charset/charsetmod.c
index 7796c2d85a29010f7431dab03a6d77d5c8ac5ff1..6361bb2bac80b888be1225d1262d08e6b3eae994 100644
--- a/src/modules/_Charset/charsetmod.c
+++ b/src/modules/_Charset/charsetmod.c
@@ -1275,8 +1275,7 @@ static void f_create_sjise(INT32 args)
   s->lo = 0x5c;
   s->hi = 0xfffd;
 
-  memset((s->revtab = (p_wchar1 *)xalloc((s->hi-s->lo)*sizeof(p_wchar1))), 0,
-	 (s->hi-s->lo)*sizeof(p_wchar1));
+  s->revtab = (p_wchar1 *)xcalloc(s->hi-s->lo, sizeof(p_wchar1));
 
   for(z=0, i=33; i<=126; i++, z+=94)
     for(j=33; j<=126; j++) {
@@ -1344,8 +1343,7 @@ static void f_create_euce(INT32 args)
   s->lo = 128;
   s->hi = 128;
 
-  memset((s->revtab = (p_wchar1 *)xalloc((65536-s->lo)*sizeof(p_wchar1))), 0,
-	 (65536-s->lo)*sizeof(p_wchar1));
+  s->revtab = (p_wchar1 *)xcalloc(65536-s->lo, sizeof(p_wchar1));
 
   for(z=0, i=33; i<=126; i++, z+=94)
     for(j=33; j<=126; j++) {
@@ -1402,8 +1400,7 @@ static struct std8e_stor *push_std_8bite(int args, int allargs, int lo, int hi)
   pop_n_elems(allargs);
   push_object(o);
   s8 = (struct std8e_stor *)(sp[-1].u.object->storage+std8e_stor_offs);
-  memset((s8->revtab = (p_wchar0 *)xalloc((hi-lo)*sizeof(p_wchar0))), 0,
-	 (hi-lo)*sizeof(p_wchar0));
+  s8->revtab = (p_wchar0 *)xcalloc(hi-lo, sizeof(p_wchar0));
   s8->lo = lo;
   s8->hi = hi;
   s8->lowtrans = 0;
@@ -1421,8 +1418,7 @@ static struct std16e_stor *push_std_16bite(int args, int allargs, int lo, int hi
   pop_n_elems(allargs);
   push_object(o);
   s16 = (struct std16e_stor *)(sp[-1].u.object->storage+std16e_stor_offs);
-  memset((s16->revtab = (p_wchar1 *)xalloc((hi-lo)*sizeof(p_wchar1))), 0,
-	 (hi-lo)*sizeof(p_wchar1));
+  s16->revtab = (p_wchar1 *)xcalloc(hi-lo, sizeof(p_wchar1));
   s16->lo = lo;
   s16->hi = hi;
   s16->lowtrans = 0;
diff --git a/src/modules/_Charset/iso2022.c b/src/modules/_Charset/iso2022.c
index bb2bbe53e4089dfd48e62af2120d23ca4ac4b78a..9813f4936bee042f7efd03155255fc8abfb7598a 100644
--- a/src/modules/_Charset/iso2022.c
+++ b/src/modules/_Charset/iso2022.c
@@ -1153,8 +1153,7 @@ static void eat_enc_string(struct pike_string *str, struct iso2022enc_stor *s,
 	  if(index!=0 && (ttab = transltab[mode][index-0x10])!=NULL) {
 	    switch(mode) {
 	    case MODE_94:
-	      rmap = (p_wchar1 *)xalloc((0x10000-0x100)*sizeof(p_wchar1));
-	      memset(rmap, 0, (0x10000-0x100)*sizeof(p_wchar1));
+	      rmap = (p_wchar1 *)xcalloc(0x10000-0x100, sizeof(p_wchar1));
 	      for(ch=0; ch<94; ch++)
 		if(ttab[ch]>=0x100 && ttab[ch]!=0xfffd)
 		  rmap[ttab[ch]-0x100]=ch+33;
@@ -1174,8 +1173,7 @@ static void eat_enc_string(struct pike_string *str, struct iso2022enc_stor *s,
 		ttab = NULL;
 	      break;
 	    case MODE_96:
-	      rmap = (p_wchar1 *)xalloc((0x10000-0x100)*sizeof(p_wchar1));
-	      memset(rmap, 0, (0x10000-0x100)*sizeof(p_wchar1));
+	      rmap = (p_wchar1 *)xcalloc(0x10000-0x100, sizeof(p_wchar1));
 	      for(ch=0; ch<96; ch++)
 		if(ttab[ch]>=0x100 && ttab[ch]!=0xfffd)
 		  rmap[ttab[ch]-0x100]=ch+32;
@@ -1195,8 +1193,7 @@ static void eat_enc_string(struct pike_string *str, struct iso2022enc_stor *s,
 		ttab = NULL;
 	      break;
 	    case MODE_9494:
-	      rmap = (p_wchar1 *)xalloc((0x10000-0x100)*sizeof(p_wchar1));
-	      memset(rmap, 0, (0x10000-0x100)*sizeof(p_wchar1));
+	      rmap = (p_wchar1 *)xcalloc(0x10000-0x100, sizeof(p_wchar1));
 	      for(ttt=ttab, ch=0; ch<94; ch++)
 		for(ch2=0; ch2<94; ch2++, ttt++)
 		if(*ttt>=0x100 && *ttt!=0xfffd)
@@ -1223,8 +1220,7 @@ static void eat_enc_string(struct pike_string *str, struct iso2022enc_stor *s,
 		ttab = NULL;
 	      break;
 	    case MODE_9696:
-	      rmap = (p_wchar1 *)xalloc((0x10000-0x100)*sizeof(p_wchar1));
-	      memset(rmap, 0, (0x10000-0x100)*sizeof(p_wchar1));
+	      rmap = (p_wchar1 *)xcalloc(0x10000-0x100, sizeof(p_wchar1));
 	      for(ttt=ttab, ch=0; ch<96; ch++)
 		for(ch2=0; ch2<96; ch2++, ttt++)
 		if(*ttt>=0x100 && *ttt!=0xfffd)
diff --git a/src/post_modules/GL/auto.c.in b/src/post_modules/GL/auto.c.in
index 5d892499882a11f6124b721defb7df89c3b9565f..ef46ec859d216b3065e165bca2d20b6db42263a0 100644
--- a/src/post_modules/GL/auto.c.in
+++ b/src/post_modules/GL/auto.c.in
@@ -552,8 +552,7 @@ static void my_glGenTextures( INT32 args )
   ntexts = Pike_sp[-1].u.integer;
   pop_stack();
 
-  res = xalloc( sizeof( GLint ) * ntexts );
-  memset( res, 0, sizeof(GLint)*ntexts );
+  res = xcalloc( sizeof( GLint ), ntexts );
   glGenTextures( ntexts, res );
   a = allocate_array( ntexts );
   for( i = 0; i<ntexts; i++ )
diff --git a/src/post_modules/GTK1/source/gtkobject.pre b/src/post_modules/GTK1/source/gtkobject.pre
index cece5aadf4c519a6e1b02160d321c5da52cd347f..7829e4556ccdf9f7507b724a41e69364431d786e 100644
--- a/src/post_modules/GTK1/source/gtkobject.pre
+++ b/src/post_modules/GTK1/source/gtkobject.pre
@@ -72,8 +72,8 @@ mixed signal_connect(string signal,function callback,mixed|void callback_arg )
   int id;
   struct signal_data *b;
   struct svalue *tmp1, *tmp2;
-  b = (void *)xalloc(sizeof(struct signal_data));
-  memset( b, 0, sizeof( struct signal_data ) );
+  b = (void *)xcalloc(1, sizeof(struct signal_data));
+
   if(args == 2)
   {
     push_int( 0 );
diff --git a/src/post_modules/Nettle/nettle.cmod b/src/post_modules/Nettle/nettle.cmod
index 10471b8a14329679abfe9acc551c57060f366fb0..3f29581857f59e8bafb9bb0613e59c47d0dac1af 100644
--- a/src/post_modules/Nettle/nettle.cmod
+++ b/src/post_modules/Nettle/nettle.cmod
@@ -387,10 +387,8 @@ PIKECLASS Fortuna
 
   INIT
   {
-    THIS->ctr = xalloc(16);
-    memset(THIS->ctr,0,16);
-    THIS->key = xalloc(32);
-    memset(THIS->key,0,32);
+    THIS->ctr = xcalloc(1,16);
+    THIS->key = xcalloc(1,32);
     aes_set_encrypt_key(&THIS->aes_ctx, AES256_KEY_SIZE, THIS->key);
     sha256_init(&THIS->sha_ctx);
     THIS->data = xalloc(16);