shithub: aubio

Download patch

ref: b8cedb62aba829cc1114b4df1d8cb16b42aa2374
parent: 140b460a53692bb5e5141748cc0fbf90936d23c8
author: Paul Brossier <piem@piem.org>
date: Mon Feb 27 05:26:01 EST 2017

python/ext/py-source.c: copy string uri

--- a/python/ext/py-sink.c
+++ b/python/ext/py-sink.c
@@ -80,9 +80,10 @@
     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;
--- a/python/ext/py-source.c
+++ b/python/ext/py-source.c
@@ -100,9 +100,10 @@
     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;