Skip to content

Commit

Permalink
Fix memory leak for multiple constructors
Browse files Browse the repository at this point in the history
  • Loading branch information
daanzu committed Sep 4, 2024
1 parent 1b2657e commit f7ffb83
Show file tree
Hide file tree
Showing 2 changed files with 1 addition and 3 deletions.
3 changes: 1 addition & 2 deletions cbits/pywebrtcvad.c
Original file line number Diff line number Diff line change
Expand Up @@ -22,8 +22,7 @@ static PyObject* vad_create(PyObject *self, PyObject *args)
if (WebRtcVad_Create(&handle)) {
return NULL;
}
vadptr = PyCapsule_New(handle, "WebRtcVadPtr", vad_free);
return Py_BuildValue("O", vadptr);
return PyCapsule_New(handle, "WebRtcVadPtr", vad_free);
}

static PyObject* vad_init(PyObject *self, PyObject *vadptr)
Expand Down
1 change: 0 additions & 1 deletion test_webrtcvad.py
Original file line number Diff line number Diff line change
Expand Up @@ -114,7 +114,6 @@ def test_leak_linear_usage(self):
find_voice = True
self.assertTrue(find_voice)

@unittest.expectedFailure
def test_leak_constructor(self):
nrepeats = 100000
with self._profile_memory(0.1):
Expand Down

0 comments on commit f7ffb83

Please sign in to comment.