Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 0fa35ea

Browse files
committed
fix possible refleaks
1 parent 89f8b80 commit 0fa35ea

1 file changed

Lines changed: 4 additions & 2 deletions

File tree

Python/ast.c

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -540,13 +540,15 @@ new_identifier(const char* n, PyArena *arena)
540540
if (PyUnicode_IS_ASCII(id)) {
541541
PyObject *m = PyImport_ImportModuleNoBlock("unicodedata");
542542
PyObject *id2;
543-
if (!m)
543+
if (!m) {
544+
Py_DECREF(id);
544545
return NULL;
546+
}
545547
id2 = _PyObject_CallMethodId(m, &PyId_normalize, "sO", "NFKC", id);
546548
Py_DECREF(m);
549+
Py_DECREF(id);
547550
if (!id2)
548551
return NULL;
549-
Py_DECREF(id);
550552
id = id2;
551553
}
552554
PyUnicode_InternInPlace(&id);

0 commit comments

Comments
 (0)