ref: 26eb6d0e5fb4751d554f45a075314af2ea3991a6
parent: 5652a8c325fbe66ecb765e7e38b4be4a2a9b18ae
author: Paul Brossier <piem@piem.org>
date: Tue Apr 19 14:26:35 EDT 2016
python/ext/py-source.c: fix memory leak (see #18)
--- a/python/ext/py-source.c
+++ b/python/ext/py-source.c
@@ -184,9 +184,9 @@
/* 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 @@
/* 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;
}