fix possible if unlikely leak
This commit is contained in:
parent
0f1e3ac897
commit
53aa1d7c57
|
@ -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…
Reference in New Issue