summaryrefslogtreecommitdiffstats
path: root/Modules/audioop.c
diff options
context:
space:
mode:
authorMark Dickinson <dickinsm@gmail.com>2010-07-04 10:15:11 (GMT)
committerMark Dickinson <dickinsm@gmail.com>2010-07-04 10:15:11 (GMT)
commitcc588c1d37448895f8f98b424c0e51b23c0ae783 (patch)
treec534bd36b62edda7f5ca80536355521c0e2036eb /Modules/audioop.c
parentbe7a7553cda1268b1dd2cec105345b5e0534c93f (diff)
downloadcpython-cc588c1d37448895f8f98b424c0e51b23c0ae783.zip
cpython-cc588c1d37448895f8f98b424c0e51b23c0ae783.tar.gz
cpython-cc588c1d37448895f8f98b424c0e51b23c0ae783.tar.bz2
Fix refleak in Modules/audioop.c.
Diffstat (limited to 'Modules/audioop.c')
-rw-r--r--Modules/audioop.c9
1 files changed, 7 insertions, 2 deletions
diff --git a/Modules/audioop.c b/Modules/audioop.c
index 66f1f1f..38e3e7a 100644
--- a/Modules/audioop.c
+++ b/Modules/audioop.c
@@ -807,10 +807,13 @@ audioop_tomono(PyObject *self, PyObject *args)
return 0;
cp = pcp.buf;
len = pcp.len;
- if (!audioop_check_parameters(len, size))
+ if (!audioop_check_parameters(len, size)) {
+ PyBuffer_Release(&pcp);
return NULL;
+ }
if (((len / size) & 1) != 0) {
PyErr_SetString(AudioopError, "not a whole number of frames");
+ PyBuffer_Release(&pcp);
return NULL;
}
@@ -824,8 +827,10 @@ audioop_tomono(PyObject *self, PyObject *args)
}
rv = PyBytes_FromStringAndSize(NULL, len/2);
- if ( rv == 0 )
+ if ( rv == 0 ) {
+ PyBuffer_Release(&pcp);
return 0;
+ }
ncp = (signed char *)PyBytes_AsString(rv);