From b8cedb62aba829cc1114b4df1d8cb16b42aa2374 Mon Sep 17 00:00:00 2001 From: Paul Brossier Date: Mon, 27 Feb 2017 10:26:01 +0100 Subject: [PATCH] python/ext/py-source.c: copy string uri --- python/ext/py-sink.c | 5 +++-- python/ext/py-source.c | 5 +++-- 2 files changed, 6 insertions(+), 4 deletions(-) diff --git a/python/ext/py-sink.c b/python/ext/py-sink.c index 15956d02..53db845e 100644 --- a/python/ext/py-sink.c +++ b/python/ext/py-sink.c @@ -80,9 +80,10 @@ Py_sink_new (PyTypeObject * pytype, PyObject * args, PyObject * kwds) return NULL; } - self->uri = "none"; + self->uri = NULL; if (uri != NULL) { - self->uri = uri; + self->uri = (char_t *)malloc(sizeof(char_t) * (strnlen(uri, PATH_MAX) + 1)); + strncpy(self->uri, uri, strnlen(uri, PATH_MAX) + 1); } self->samplerate = Py_aubio_default_samplerate; diff --git a/python/ext/py-source.c b/python/ext/py-source.c index d7dbe70c..bc78292a 100644 --- a/python/ext/py-source.c +++ b/python/ext/py-source.c @@ -100,9 +100,10 @@ Py_source_new (PyTypeObject * pytype, PyObject * args, PyObject * kwds) return NULL; } - self->uri = "none"; + self->uri = NULL; if (uri != NULL) { - self->uri = uri; + self->uri = (char_t *)malloc(sizeof(char_t) * (strnlen(uri, PATH_MAX) + 1)); + strncpy(self->uri, uri, strnlen(uri, PATH_MAX) + 1); } self->samplerate = 0; -- 2.11.0