diff options
author | Benjamin Peterson <benjamin@python.org> | 2014-01-26 15:24:24 (GMT) |
---|---|---|
committer | Benjamin Peterson <benjamin@python.org> | 2014-01-26 15:24:24 (GMT) |
commit | 08673c57f02cf85bc8336cdd7cc90ee530c41ecc (patch) | |
tree | 1615c9893395cc6745c5e0dcef6fe23c65af2862 /Modules/audioop.c | |
parent | 77b286b2ccccc407d8ed17b0543b10f7c1ccc864 (diff) | |
download | cpython-08673c57f02cf85bc8336cdd7cc90ee530c41ecc.zip cpython-08673c57f02cf85bc8336cdd7cc90ee530c41ecc.tar.gz cpython-08673c57f02cf85bc8336cdd7cc90ee530c41ecc.tar.bz2 |
fix refleak on error
Diffstat (limited to 'Modules/audioop.c')
-rw-r--r-- | Modules/audioop.c | 11 |
1 files changed, 7 insertions, 4 deletions
diff --git a/Modules/audioop.c b/Modules/audioop.c index e0610f3..cc3a020 100644 --- a/Modules/audioop.c +++ b/Modules/audioop.c @@ -1608,7 +1608,7 @@ audioop_lin2adpcm_impl(PyModuleDef *module, Py_buffer *fragment, int width, PyOb Py_ssize_t i; int step, valpred, delta, index, sign, vpdiff, diff; - PyObject *rv, *str; + PyObject *rv = NULL, *str; int outputbuffer = 0, bufferstep; if (!audioop_check_parameters(fragment->len, width)) @@ -1626,9 +1626,10 @@ audioop_lin2adpcm_impl(PyModuleDef *module, Py_buffer *fragment, int width, PyOb index = 0; } else if (!PyTuple_Check(state)) { PyErr_SetString(PyExc_TypeError, "state must be a tuple or None"); - return NULL; - } else if (!PyArg_ParseTuple(state, "ii", &valpred, &index)) - return NULL; + goto exit; + } else if (!PyArg_ParseTuple(state, "ii", &valpred, &index)) { + goto exit; + } step = stepsizeTable[index]; bufferstep = 1; @@ -1704,6 +1705,8 @@ audioop_lin2adpcm_impl(PyModuleDef *module, Py_buffer *fragment, int width, PyOb bufferstep = !bufferstep; } rv = Py_BuildValue("(O(ii))", str, valpred, index); + + exit: Py_DECREF(str); return rv; } |