Index: libroardsp/convert.c
===================================================================
--- libroardsp/convert.c	(revision 2797)
+++ libroardsp/convert.c	(revision 3063)
@@ -548,6 +548,6 @@
  double radio = (double) to / (double) from;
  int outsamples = radio * samples;
- float * inf  = malloc(samples*sizeof(float));
- float * outf = malloc(outsamples*sizeof(float));
+ float * inf  = roar_mm_malloc(samples*sizeof(float));
+ float * outf = roar_mm_malloc(outsamples*sizeof(float));
  int i;
  SRC_DATA srcdata;
@@ -557,5 +557,5 @@
  if ( inf == NULL ) {
   if ( outf != NULL )
-   free(outf);
+   roar_mm_free(outf);
 
   return -1;
@@ -564,5 +564,5 @@
  if ( outf == NULL ) {
   if ( inf != NULL )
-   free(inf);
+   roar_mm_free(inf);
 
   return -1;
@@ -583,6 +583,6 @@
    break;
   default:
-    free(outf);
-    free(inf);
+    roar_mm_free(outf);
+    roar_mm_free(inf);
     return -1;
  }
@@ -595,6 +595,6 @@
 
  if ( src_simple(&srcdata, SRC_ZERO_ORDER_HOLD, channels) != 0 ) {
-  free(outf);
-  free(inf);
+  roar_mm_free(outf);
+  roar_mm_free(inf);
   return -1;
  }
@@ -616,6 +616,6 @@
  }
 
- free(outf);
- free(inf);
+ roar_mm_free(outf);
+ roar_mm_free(inf);
 
  return 0;
@@ -883,8 +883,8 @@
   real_out = out;
 
-  if ( (out = malloc(from_size)) == NULL )
-   return -1;
-
-  ROAR_DBG("roar_conv(*): malloc(%i)=%p", (int)from_size, out);
+  if ( (out = roar_mm_malloc(from_size)) == NULL )
+   return -1;
+
+  ROAR_DBG("roar_conv(*): roar_mm_malloc(%i)=%p", (int)from_size, out);
  }
 
@@ -895,5 +895,5 @@
   if ( roar_conv_endian(out, ip, samples, ROAR_CODEC_BYTE_ORDER(from->codec), ROAR_CODEC_NATIVE_ENDIAN, from->bits) == -1 ) {
    if ( to_size < from_size )
-    free(out);
+    roar_mm_free(out);
    return -1;
   } else {
@@ -905,5 +905,5 @@
   if ( roar_conv_bits(out, ip, samples, from->bits, to->bits) == -1 ) {
    if ( to_size < from_size )
-    free(out);
+    roar_mm_free(out);
    return -1;
   } else {
@@ -915,5 +915,5 @@
   if ( roar_conv_signedness(out, ip, samples, ROAR_CODEC_IS_SIGNED(from->codec), ROAR_CODEC_IS_SIGNED(to->codec), to->bits) == -1 ) {
    if ( to_size < from_size )
-    free(out);
+    roar_mm_free(out);
    return -1;
   } else {
@@ -935,5 +935,5 @@
    ROAR_DBG("roar_conv(*): failed to convert rate %i->%i (%ich%ibits)", from->rate, to->rate, to->bits, from->channels);
    if ( to_size < from_size )
-    free(out);
+    roar_mm_free(out);
    return -1;
   } else {
@@ -946,5 +946,5 @@
   if ( roar_conv_chans(out, ip, samples, from->channels, to->channels, to->bits) == -1 ) {
    if ( to_size < from_size )
-    free(out);
+    roar_mm_free(out);
    return -1;
   } else {
@@ -956,5 +956,5 @@
   if ( roar_conv_endian(out, ip, samples, ROAR_CODEC_NATIVE_ENDIAN, ROAR_CODEC_BYTE_ORDER(to->codec), to->bits) == -1 ) {
    if ( to_size < from_size )
-    free(out);
+    roar_mm_free(out);
    return -1;
   } else {
@@ -966,5 +966,5 @@
   ROAR_DBG("roar_conv(*): memcpy(%p, %p, %i) = ?", real_out, out, (int)to_size);
   memcpy(real_out, out, to_size);
-  free(out);
+  roar_mm_free(out);
   ROAR_DBG("roar_conv(*): free(%p): OK!", out);
  }
Index: libroardsp/transcode_celt.c
===================================================================
--- libroardsp/transcode_celt.c	(revision 2204)
+++ libroardsp/transcode_celt.c	(revision 3063)
@@ -31,5 +31,5 @@
 
 int roar_xcoder_celt_init       (struct roar_xcoder * state) {
- struct roar_xcoder_celt * self = malloc(sizeof(struct roar_xcoder_celt));
+ struct roar_xcoder_celt * self = roar_mm_malloc(sizeof(struct roar_xcoder_celt));
  struct roar_audio_info  * info = &(state->info.pcm);
 
@@ -39,5 +39,5 @@
  // curruntly only 16 bit mode is supported
  if ( info->bits != 16 ) {
-  free(self);
+  roar_mm_free(self);
   return -1;
  }
@@ -50,8 +50,8 @@
 
  self->bufferlen            = info->channels * 32 + _SIZE_LEN;
- self->iobuffer             = malloc(self->bufferlen);
+ self->iobuffer             = roar_mm_malloc(self->bufferlen);
 
  if ( self->iobuffer == NULL ) {
-  free(self);
+  roar_mm_free(self);
   return -1;
  }
@@ -60,5 +60,6 @@
 
  if ( self->mode == NULL ) {
-  free(self);
+  roar_mm_free(self->iobuffer);
+  roar_mm_free(self);
   return -1;
  }
@@ -87,5 +88,5 @@
 
  if ( self->iobuffer )
-  free(self->iobuffer);
+  roar_mm_free(self->iobuffer);
 
  if ( self->encoder )
@@ -98,5 +99,5 @@
   celt_mode_destroy(self->mode);
 
- free(self);
+ roar_mm_free(self);
 
  ROAR_DBG("roar_xcoder_celt_uninit(*) = 0");
Index: libroardsp/transcode_speex.c
===================================================================
--- libroardsp/transcode_speex.c	(revision 2974)
+++ libroardsp/transcode_speex.c	(revision 3063)
@@ -33,5 +33,5 @@
 
 int roar_xcoder_speex_init       (struct roar_xcoder * state) {
- struct roar_xcoder_speex * self = malloc(sizeof(struct roar_xcoder_speex));
+ struct roar_xcoder_speex * self = roar_mm_malloc(sizeof(struct roar_xcoder_speex));
  struct roar_audio_info  * info = &(state->info.pcm);
  int tmp;
@@ -44,5 +44,5 @@
  // curruntly only 16 bit mode is supported
  if ( info->bits != 16 ) {
-  free(self);
+  roar_mm_free(self);
   return -1;
  }
@@ -53,5 +53,5 @@
   case 2: self->stereo = 1; break;
   default:
-    free(self);
+    roar_mm_free(self);
     return -1;
  }
@@ -140,5 +140,5 @@
  speex_bits_destroy(&(self->bits));
 
- free(self);
+ roar_mm_free(self);
 
  return 0;
Index: libroardsp/vio_transcode.c
===================================================================
--- libroardsp/vio_transcode.c	(revision 2644)
+++ libroardsp/vio_transcode.c	(revision 3063)
@@ -27,5 +27,5 @@
 int     roar_vio_open_xcode    (struct roar_vio_calls * calls, int encoder, struct roar_audio_info * info,
                                 struct roar_vio_calls * dst) {
- struct roar_xcoder * xcoder = malloc(sizeof(struct roar_xcoder));
+ struct roar_xcoder * xcoder = roar_mm_malloc(sizeof(struct roar_xcoder));
 
  if ( xcoder == NULL )
@@ -33,10 +33,10 @@
 
  if ( calls == NULL || info == NULL || dst == NULL ) {
-  free(xcoder);
+  roar_mm_free(xcoder);
   return -1;
  }
 
  if ( roar_xcoder_init(xcoder, encoder, info, dst) == -1 ) {
-  free(xcoder);
+  roar_mm_free(xcoder);
   return -1;
  }
@@ -94,5 +94,5 @@
 
  if ( vio->inst != NULL )
-  free(vio->inst);
+  roar_mm_free(vio->inst);
 
  return ret;
@@ -101,5 +101,5 @@
 int     roar_vio_open_bixcode    (struct roar_vio_calls * calls, struct roar_audio_info * info,
                                   struct roar_vio_calls * dst) {
- struct roar_bixcoder * bixcoder = malloc(sizeof(struct roar_bixcoder));
+ struct roar_bixcoder * bixcoder = roar_mm_malloc(sizeof(struct roar_bixcoder));
 
  if ( bixcoder == NULL )
@@ -107,10 +107,10 @@
 
  if ( calls == NULL || info == NULL || dst == NULL ) {
-  free(bixcoder);
+  roar_mm_free(bixcoder);
   return -1;
  }
 
  if ( roar_bixcoder_init(bixcoder, info, dst) == -1 ) {
-  free(bixcoder);
+  roar_mm_free(bixcoder);
   return -1;
  }
@@ -165,5 +165,5 @@
 
  if ( vio->inst != NULL )
-  free(vio->inst);
+  roar_mm_free(vio->inst);
 
  return ret;
