mirror of
https://github.com/python/cpython.git
synced 2025-11-25 12:44:13 +00:00
fix refleak on error
This commit is contained in:
parent
77b286b2cc
commit
08673c57f0
1 changed files with 7 additions and 4 deletions
|
|
@ -1608,7 +1608,7 @@ audioop_lin2adpcm_impl(PyModuleDef *module, Py_buffer *fragment, int width, PyOb
|
||||||
Py_ssize_t i;
|
Py_ssize_t i;
|
||||||
int step, valpred, delta,
|
int step, valpred, delta,
|
||||||
index, sign, vpdiff, diff;
|
index, sign, vpdiff, diff;
|
||||||
PyObject *rv, *str;
|
PyObject *rv = NULL, *str;
|
||||||
int outputbuffer = 0, bufferstep;
|
int outputbuffer = 0, bufferstep;
|
||||||
|
|
||||||
if (!audioop_check_parameters(fragment->len, width))
|
if (!audioop_check_parameters(fragment->len, width))
|
||||||
|
|
@ -1626,9 +1626,10 @@ audioop_lin2adpcm_impl(PyModuleDef *module, Py_buffer *fragment, int width, PyOb
|
||||||
index = 0;
|
index = 0;
|
||||||
} else if (!PyTuple_Check(state)) {
|
} else if (!PyTuple_Check(state)) {
|
||||||
PyErr_SetString(PyExc_TypeError, "state must be a tuple or None");
|
PyErr_SetString(PyExc_TypeError, "state must be a tuple or None");
|
||||||
return NULL;
|
goto exit;
|
||||||
} else if (!PyArg_ParseTuple(state, "ii", &valpred, &index))
|
} else if (!PyArg_ParseTuple(state, "ii", &valpred, &index)) {
|
||||||
return NULL;
|
goto exit;
|
||||||
|
}
|
||||||
|
|
||||||
step = stepsizeTable[index];
|
step = stepsizeTable[index];
|
||||||
bufferstep = 1;
|
bufferstep = 1;
|
||||||
|
|
@ -1704,6 +1705,8 @@ audioop_lin2adpcm_impl(PyModuleDef *module, Py_buffer *fragment, int width, PyOb
|
||||||
bufferstep = !bufferstep;
|
bufferstep = !bufferstep;
|
||||||
}
|
}
|
||||||
rv = Py_BuildValue("(O(ii))", str, valpred, index);
|
rv = Py_BuildValue("(O(ii))", str, valpred, index);
|
||||||
|
|
||||||
|
exit:
|
||||||
Py_DECREF(str);
|
Py_DECREF(str);
|
||||||
return rv;
|
return rv;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue