From: Paul Brossier Date: Mon, 27 Feb 2017 09:26:01 +0000 (+0100) Subject: python/ext/py-source.c: copy string uri X-Git-Tag: 0.4.5~78 X-Git-Url: https://git.aubio.org/?a=commitdiff_plain;h=b8cedb62aba829cc1114b4df1d8cb16b42aa2374;p=aubio.git python/ext/py-source.c: copy string uri --- 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;