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
140140 {
141141 self->o = new_aubio_source ( self->uri, self->samplerate, self->hop_size );
142142 if (self->o == NULL) {
143− char_t errstr[30 + strlen(self->uri)];
144− sprintf(errstr, "error creating source with %s", self->uri);
145− PyErr_SetString (PyExc_RuntimeError, errstr);
143+ PyErr_Format (PyExc_RuntimeError, "error creating source with \"%s\"",
144+ self->uri);
146145 return -1;
147146 }
148147 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
160159 static void
161160 Py_source_del (Py_source *self, PyObject *unused)
162161 {
163− del_aubio_source(self->o);
164− //del_fvec(self->read_to);
162+ if (self->o) {
163+ del_aubio_source(self->o);
164+ free(self->mread_to.data);
165+ }
165166 Py_XDECREF(self->read_to);
166167 Py_XDECREF(self->mread_to);
167168 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