Index: src/io/sink_apple_audio.c
===================================================================
--- src/io/sink_apple_audio.c	(revision ae5d58a7ec6083e54c14da6dd2ac8d755a0e9224)
+++ src/io/sink_apple_audio.c	(revision b643a33823c19608bcf924edf18ba048dd3198a4)
@@ -60,5 +60,4 @@
 aubio_sink_apple_audio_t * new_aubio_sink_apple_audio(const char_t * uri, uint_t samplerate) {
   aubio_sink_apple_audio_t * s = AUBIO_NEW(aubio_sink_apple_audio_t);
-  s->path = uri;
   s->max_frames = MAX_SIZE;
   s->async = false;
@@ -68,4 +67,7 @@
     goto beach;
   }
+  if (s->path != NULL) AUBIO_FREE(s->path);
+  s->path = AUBIO_ARRAY(char_t, strnlen(uri, PATH_MAX));
+  strncpy(s->path, uri, strnlen(uri, PATH_MAX));
 
   s->samplerate = 0;
@@ -250,4 +252,5 @@
 void del_aubio_sink_apple_audio(aubio_sink_apple_audio_t * s) {
   if (s->audioFile) aubio_sink_apple_audio_close (s);
+  if (s->path) AUBIO_FREE(s->path);
   freeAudioBufferList(&s->bufferList);
   AUBIO_FREE(s);
Index: src/io/sink_sndfile.c
===================================================================
--- src/io/sink_sndfile.c	(revision ae5d58a7ec6083e54c14da6dd2ac8d755a0e9224)
+++ src/io/sink_sndfile.c	(revision b643a33823c19608bcf924edf18ba048dd3198a4)
@@ -57,5 +57,4 @@
   aubio_sink_sndfile_t * s = AUBIO_NEW(aubio_sink_sndfile_t);
   s->max_size = MAX_SIZE;
-  s->path = path;
 
   if (path == NULL) {
@@ -63,4 +62,8 @@
     return NULL;
   }
+
+  if (s->path) AUBIO_FREE(s->path);
+  s->path = AUBIO_ARRAY(char_t, strnlen(path, PATH_MAX));
+  strncpy(s->path, path, strnlen(path, PATH_MAX));
 
   s->samplerate = 0;
@@ -220,4 +223,5 @@
 void del_aubio_sink_sndfile(aubio_sink_sndfile_t * s){
   if (!s) return;
+  if (s->path) AUBIO_FREE(s->path);
   aubio_sink_sndfile_close(s);
   AUBIO_FREE(s->scratch_data);
Index: src/io/sink_wavwrite.c
===================================================================
--- src/io/sink_wavwrite.c	(revision ae5d58a7ec6083e54c14da6dd2ac8d755a0e9224)
+++ src/io/sink_wavwrite.c	(revision b643a33823c19608bcf924edf18ba048dd3198a4)
@@ -90,5 +90,8 @@
   }
 
-  s->path = path;
+  if (s->path) AUBIO_FREE(s->path);
+  s->path = AUBIO_ARRAY(char_t, strnlen(path, PATH_MAX));
+  strncpy(s->path, path, strnlen(path, PATH_MAX));
+
   s->max_size = MAX_SIZE;
   s->bitspersample = 16;
@@ -288,4 +291,5 @@
   if (!s) return;
   aubio_sink_wavwrite_close(s);
+  if (s->path) AUBIO_FREE(s->path);
   AUBIO_FREE(s->scratch_data);
   AUBIO_FREE(s);
Index: src/io/source_apple_audio.c
===================================================================
--- src/io/source_apple_audio.c	(revision ae5d58a7ec6083e54c14da6dd2ac8d755a0e9224)
+++ src/io/source_apple_audio.c	(revision b643a33823c19608bcf924edf18ba048dd3198a4)
@@ -80,5 +80,4 @@
   s->block_size = block_size;
   s->samplerate = samplerate;
-  s->path = path;
 
   if ( aubio_source_apple_audio_open ( s, path ) ) {
@@ -96,8 +95,11 @@
   OSStatus err = noErr;
   UInt32 propSize;
-  s->path = path;
+
+  if (s->path) AUBIO_FREE(s->path);
+  s->path = AUBIO_ARRAY(char_t, strnlen(path, PATH_MAX));
+  strncpy(s->path, path, strnlen(path, PATH_MAX));
 
   // open the resource url
-  CFURLRef fileURL = createURLFromPath(path);
+  CFURLRef fileURL = createURLFromPath(s->path);
   err = ExtAudioFileOpenURL(fileURL, &s->audioFile);
   CFRelease(fileURL);
@@ -294,4 +296,5 @@
 void del_aubio_source_apple_audio(aubio_source_apple_audio_t * s){
   aubio_source_apple_audio_close (s);
+  if (s->path) AUBIO_FREE(s->path);
   freeAudioBufferList(&s->bufferList);
   AUBIO_FREE(s);
Index: src/io/source_avcodec.c
===================================================================
--- src/io/source_avcodec.c	(revision ae5d58a7ec6083e54c14da6dd2ac8d755a0e9224)
+++ src/io/source_avcodec.c	(revision b643a33823c19608bcf924edf18ba048dd3198a4)
@@ -85,5 +85,8 @@
   s->hop_size = hop_size;
   s->channels = 1;
-  s->path = path;
+
+  if (s->path) AUBIO_FREE(s->path);
+  s->path = AUBIO_ARRAY(char_t, strnlen(path, PATH_MAX));
+  strncpy(s->path, path, strnlen(path, PATH_MAX));
 
   // register all formats and codecs
@@ -425,4 +428,5 @@
     av_frame_free( &(s->avFrame) );
   }
+  if (s->path) AUBIO_FREE(s->path);
   s->avFrame = NULL;
   AUBIO_FREE(s);
Index: src/io/source_sndfile.c
===================================================================
--- src/io/source_sndfile.c	(revision ae5d58a7ec6083e54c14da6dd2ac8d755a0e9224)
+++ src/io/source_sndfile.c	(revision b643a33823c19608bcf924edf18ba048dd3198a4)
@@ -87,5 +87,8 @@
   s->hop_size = hop_size;
   s->channels = 1;
-  s->path = path;
+
+  if (s->path) AUBIO_FREE(s->path);
+  s->path = AUBIO_ARRAY(char_t, strnlen(path, PATH_MAX));
+  strncpy(s->path, path, strnlen(path, PATH_MAX));
 
   // try opening the file, getting the info in sfinfo
@@ -306,4 +309,5 @@
   }
 #endif /* HAVE_SAMPLERATE */
+  if (s->path) AUBIO_FREE(s->path);
   AUBIO_FREE(s->scratch_data);
   AUBIO_FREE(s);
Index: src/io/source_wavread.c
===================================================================
--- src/io/source_wavread.c	(revision ae5d58a7ec6083e54c14da6dd2ac8d755a0e9224)
+++ src/io/source_wavread.c	(revision b643a33823c19608bcf924edf18ba048dd3198a4)
@@ -87,5 +87,8 @@
   }
 
-  s->path = path;
+  if (s->path) AUBIO_FREE(s->path);
+  s->path = AUBIO_ARRAY(char_t, strnlen(path, PATH_MAX));
+  strncpy(s->path, path, strnlen(path, PATH_MAX));
+
   s->samplerate = samplerate;
   s->hop_size = hop_size;
@@ -389,4 +392,5 @@
   if (s->short_output) AUBIO_FREE(s->short_output);
   if (s->output) del_fmat(s->output);
+  if (s->path) AUBIO_FREE(s->path);
   AUBIO_FREE(s);
 }
