mirror of
https://github.com/python/cpython.git
synced 2025-12-04 00:30:19 +00:00
fix possible if unlikely leak
This commit is contained in:
parent
0f1e3ac897
commit
53aa1d7c57
1 changed files with 6 additions and 2 deletions
|
|
@ -8888,9 +8888,13 @@ unicode_maketrans(PyUnicodeObject *null, PyObject *args)
|
||||||
/* create entries for translating chars in x to those in y */
|
/* create entries for translating chars in x to those in y */
|
||||||
for (i = 0; i < PyUnicode_GET_SIZE(x); i++) {
|
for (i = 0; i < PyUnicode_GET_SIZE(x); i++) {
|
||||||
key = PyLong_FromLong(PyUnicode_AS_UNICODE(x)[i]);
|
key = PyLong_FromLong(PyUnicode_AS_UNICODE(x)[i]);
|
||||||
value = PyLong_FromLong(PyUnicode_AS_UNICODE(y)[i]);
|
if (!key)
|
||||||
if (!key || !value)
|
|
||||||
goto err;
|
goto err;
|
||||||
|
value = PyLong_FromLong(PyUnicode_AS_UNICODE(y)[i]);
|
||||||
|
if (!value) {
|
||||||
|
Py_DECREF(key);
|
||||||
|
goto err;
|
||||||
|
}
|
||||||
res = PyDict_SetItem(new, key, value);
|
res = PyDict_SetItem(new, key, value);
|
||||||
Py_DECREF(key);
|
Py_DECREF(key);
|
||||||
Py_DECREF(value);
|
Py_DECREF(value);
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue