From: Paul Brossier Date: Tue, 19 Apr 2016 16:26:35 +0000 (+0200) Subject: python/ext/py-source.c: fix memory leak (see #18) X-Git-Tag: 0.4.4~300^2~305 X-Git-Url: https://git.aubio.org/?a=commitdiff_plain;h=26eb6d0e5fb4751d554f45a075314af2ea3991a6;p=aubio.git python/ext/py-source.c: fix memory leak (see #18) --- diff --git a/python/ext/py-source.c b/python/ext/py-source.c index b0eb2d9d..a3096a10 100644 --- a/python/ext/py-source.c +++ b/python/ext/py-source.c @@ -184,9 +184,9 @@ Py_source_do(Py_source * self, PyObject * args) /* compute _do function */ aubio_source_do (self->o, self->read_to, &read); - PyObject *outputs = PyList_New(0); - PyList_Append( outputs, (PyObject *)PyAubio_CFvecToArray (self->read_to)); - PyList_Append( outputs, (PyObject *)PyLong_FromLong(read)); + PyObject *outputs = PyTuple_New(2); + PyTuple_SetItem( outputs, 0, (PyObject *)PyAubio_CFvecToArray (self->read_to) ); + PyTuple_SetItem( outputs, 1, (PyObject *)PyLong_FromLong(read)); return outputs; } @@ -211,9 +211,9 @@ Py_source_do_multi(Py_source * self, PyObject * args) /* compute _do function */ aubio_source_do_multi (self->o, self->mread_to, &read); - PyObject *outputs = PyList_New(0); - PyList_Append( outputs, (PyObject *)PyAubio_CFmatToArray (self->mread_to)); - PyList_Append( outputs, (PyObject *)PyLong_FromLong(read)); + PyObject *outputs = PyTuple_New(2); + PyTuple_SetItem( outputs, 0, (PyObject *)PyAubio_CFmatToArray (self->mread_to)); + PyTuple_SetItem( outputs, 1, (PyObject *)PyLong_FromLong(read)); return outputs; }