mirror of
https://github.com/python/cpython.git
synced 2025-07-23 19:25:40 +00:00
fix possible refleaks
This commit is contained in:
parent
89f8b80202
commit
0fa35ea8f3
1 changed files with 4 additions and 2 deletions
|
@ -540,13 +540,15 @@ new_identifier(const char* n, PyArena *arena)
|
||||||
if (PyUnicode_IS_ASCII(id)) {
|
if (PyUnicode_IS_ASCII(id)) {
|
||||||
PyObject *m = PyImport_ImportModuleNoBlock("unicodedata");
|
PyObject *m = PyImport_ImportModuleNoBlock("unicodedata");
|
||||||
PyObject *id2;
|
PyObject *id2;
|
||||||
if (!m)
|
if (!m) {
|
||||||
|
Py_DECREF(id);
|
||||||
return NULL;
|
return NULL;
|
||||||
|
}
|
||||||
id2 = _PyObject_CallMethodId(m, &PyId_normalize, "sO", "NFKC", id);
|
id2 = _PyObject_CallMethodId(m, &PyId_normalize, "sO", "NFKC", id);
|
||||||
Py_DECREF(m);
|
Py_DECREF(m);
|
||||||
|
Py_DECREF(id);
|
||||||
if (!id2)
|
if (!id2)
|
||||||
return NULL;
|
return NULL;
|
||||||
Py_DECREF(id);
|
|
||||||
id = id2;
|
id = id2;
|
||||||
}
|
}
|
||||||
PyUnicode_InternInPlace(&id);
|
PyUnicode_InternInPlace(&id);
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue