aubio_sink_sndfile_t * new_aubio_sink_sndfile(const char_t * path, uint_t samplerate) {
aubio_sink_sndfile_t * s = AUBIO_NEW(aubio_sink_sndfile_t);
s->max_size = MAX_SIZE;
- s->path = path;
if (path == NULL) {
AUBIO_ERR("sink_sndfile: Aborted opening null path\n");
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;
s->channels = 0;
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);
AUBIO_FREE(s);