Skip to content

Commit

Permalink
fix memory leak bug of PyObj2Matrix
Browse files Browse the repository at this point in the history
  • Loading branch information
wanglong001 committed May 31, 2019
1 parent 0ff6fb0 commit 59b1f8c
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions kaldi/matrix/matrix-ext.cc
Original file line number Diff line number Diff line change
Expand Up @@ -127,6 +127,7 @@ static PyObject* _allocator(PyTypeObject* type, Py_ssize_t nitems);
static int _ctor(PyObject* self, PyObject* args, PyObject* kw);

static void _deallocator(PyObject* self) {
reinterpret_cast<wrapper*>(self)->cpp.Destruct();
Py_XDECREF(reinterpret_cast<wrapper*>(self)->base);
Py_TYPE(self)->tp_free(self);
}
Expand Down Expand Up @@ -350,6 +351,7 @@ static PyObject* _allocator(PyTypeObject* type, Py_ssize_t nitems);
static int _ctor(PyObject* self, PyObject* args, PyObject* kw);

static void _deallocator(PyObject* self) {
reinterpret_cast<wrapper*>(self)->cpp.Destruct();
Py_XDECREF(reinterpret_cast<wrapper*>(self)->base);
Py_TYPE(self)->tp_free(self);
}
Expand Down Expand Up @@ -558,6 +560,7 @@ static PyObject* _allocator(PyTypeObject* type, Py_ssize_t nitems);
static int _ctor(PyObject* self, PyObject* args, PyObject* kw);

static void _deallocator(PyObject* self) {
reinterpret_cast<wrapper*>(self)->cpp.Destruct();
Py_XDECREF(reinterpret_cast<wrapper*>(self)->base);
Py_TYPE(self)->tp_free(self);
}
Expand Down Expand Up @@ -781,6 +784,7 @@ static PyObject* _allocator(PyTypeObject* type, Py_ssize_t nitems);
static int _ctor(PyObject* self, PyObject* args, PyObject* kw);

static void _deallocator(PyObject* self) {
reinterpret_cast<wrapper*>(self)->cpp.Destruct();
Py_XDECREF(reinterpret_cast<wrapper*>(self)->base);
Py_TYPE(self)->tp_free(self);
}
Expand Down

0 comments on commit 59b1f8c

Please sign in to comment.