forked from auracaster/pyalsaaudio
Fix memory leaks in PCM.write() error paths on python3
This commit is contained in:
committed by
Oswald Buddenhagen
parent
bdca4dc061
commit
07ac637b1c
@@ -1445,6 +1445,11 @@ static PyObject *alsapcm_write(alsapcm_t *self, PyObject *args)
|
||||
if (!self->handle)
|
||||
{
|
||||
PyErr_SetString(ALSAAudioError, "PCM device is closed");
|
||||
|
||||
#if PY_MAJOR_VERSION >= 3
|
||||
PyBuffer_Release(&buf);
|
||||
#endif
|
||||
|
||||
return NULL;
|
||||
}
|
||||
|
||||
@@ -1452,6 +1457,10 @@ static PyObject *alsapcm_write(alsapcm_t *self, PyObject *args)
|
||||
{
|
||||
PyErr_SetString(ALSAAudioError,
|
||||
"Data size must be a multiple of framesize");
|
||||
|
||||
#if PY_MAJOR_VERSION >= 3
|
||||
PyBuffer_Release(&buf);
|
||||
#endif
|
||||
return NULL;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user