Kaydet (Commit) cc588c1d authored tarafından Mark Dickinson's avatar Mark Dickinson

Fix refleak in Modules/audioop.c.

üst be7a7553
...@@ -807,10 +807,13 @@ audioop_tomono(PyObject *self, PyObject *args) ...@@ -807,10 +807,13 @@ audioop_tomono(PyObject *self, PyObject *args)
return 0; return 0;
cp = pcp.buf; cp = pcp.buf;
len = pcp.len; len = pcp.len;
if (!audioop_check_parameters(len, size)) if (!audioop_check_parameters(len, size)) {
PyBuffer_Release(&pcp);
return NULL; return NULL;
}
if (((len / size) & 1) != 0) { if (((len / size) & 1) != 0) {
PyErr_SetString(AudioopError, "not a whole number of frames"); PyErr_SetString(AudioopError, "not a whole number of frames");
PyBuffer_Release(&pcp);
return NULL; return NULL;
} }
...@@ -824,8 +827,10 @@ audioop_tomono(PyObject *self, PyObject *args) ...@@ -824,8 +827,10 @@ audioop_tomono(PyObject *self, PyObject *args)
} }
rv = PyBytes_FromStringAndSize(NULL, len/2); rv = PyBytes_FromStringAndSize(NULL, len/2);
if ( rv == 0 ) if ( rv == 0 ) {
PyBuffer_Release(&pcp);
return 0; return 0;
}
ncp = (signed char *)PyBytes_AsString(rv); ncp = (signed char *)PyBytes_AsString(rv);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment