[py] check sink was created before calling del_aubio_sink
authorPaul Brossier <piem@piem.org>
Fri, 21 Dec 2018 14:00:34 +0000 (15:00 +0100)
committerPaul Brossier <piem@piem.org>
Fri, 21 Dec 2018 14:00:34 +0000 (15:00 +0100)
python/ext/py-sink.c

index f274776..4fc514f 100644 (file)
@@ -150,8 +150,10 @@ Py_sink_init (Py_sink * self, PyObject * args, PyObject * kwds)
 static void
 Py_sink_del (Py_sink *self, PyObject *unused)
 {
-  del_aubio_sink(self->o);
-  free(self->mwrite_data.data);
+  if (self->o) {
+    del_aubio_sink(self->o);
+    free(self->mwrite_data.data);
+  }
   if (self->uri) {
     free(self->uri);
   }