History

python/ext/py-source.c: fix error string, only delete if created

Paul Brossier committed 10 years ago

Commit cd2791f1 parent 44312de1 file · +6 −5Browse files

Showing the changes to python/ext (1 of 1 file). Show all

Unified · Split

python/ext/py-source.c+6−5
@@ -140,9 +140,8 @@ Py_source_init (Py_source * self, PyObject * args, PyObject * kwds) · 139 unmodified lines
140{140{
141 self->o = new_aubio_source ( self->uri, self->samplerate, self->hop_size );141 self->o = new_aubio_source ( self->uri, self->samplerate, self->hop_size );
142 if (self->o == NULL) {142 if (self->o == NULL) {
143 char_t errstr[30 + strlen(self->uri)];143 PyErr_Format (PyExc_RuntimeError, "error creating source with \"%s\"",
144 sprintf(errstr, "error creating source with %s", self->uri);144 self->uri);
145 PyErr_SetString (PyExc_RuntimeError, errstr);
146 return -1;145 return -1;
147 }146 }
148 self->samplerate = aubio_source_get_samplerate ( self->o );147 self->samplerate = aubio_source_get_samplerate ( self->o );
@@ -160,8 +159,10 @@ Py_source_init (Py_source * self, PyObject * args, PyObject * kwds) · 11 unmodified lines
160static void159static void
161Py_source_del (Py_source *self, PyObject *unused)160Py_source_del (Py_source *self, PyObject *unused)
162{161{
163 del_aubio_source(self->o);162 if (self->o) {
164 //del_fvec(self->read_to);163 del_aubio_source(self->o);
164 free(self->mread_to.data);
165 }
165 Py_XDECREF(self->read_to);166 Py_XDECREF(self->read_to);
166 Py_XDECREF(self->mread_to);167 Py_XDECREF(self->mread_to);
167 Py_TYPE(self)->tp_free((PyObject *) self);168 Py_TYPE(self)->tp_free((PyObject *) self);

Keyboard shortcuts

General

Show keyboard shortcuts
?
Focus the current search
/

Issues and pull requests

Open filters
f

Issues, pull requests and Inbox

Select next item
j↓
Select previous item
k↑
Open selected item
Enter
Dismiss filters or clear selection
Esc

Repository code

Go to file
t