]> granicus.if.org Git - python/commitdiff
fix possible refleaks
authorBenjamin Peterson <benjamin@python.org>
Mon, 16 Jan 2012 14:50:48 +0000 (09:50 -0500)
committerBenjamin Peterson <benjamin@python.org>
Mon, 16 Jan 2012 14:50:48 +0000 (09:50 -0500)
Python/ast.c

index 9776a6a15151e3b27e2e142c6f8938a65765d32f..c70073cdab5b9f4ed796a8a3c6ad00db3f54bb0c 100644 (file)
@@ -540,13 +540,15 @@ new_identifier(const char* n, PyArena *arena)
     if (PyUnicode_IS_ASCII(id)) {
         PyObject *m = PyImport_ImportModuleNoBlock("unicodedata");
         PyObject *id2;
-        if (!m)
+        if (!m) {
+            Py_DECREF(id);
             return NULL;
+        }
         id2 = _PyObject_CallMethodId(m, &PyId_normalize, "sO", "NFKC", id);
         Py_DECREF(m);
+        Py_DECREF(id);
         if (!id2)
             return NULL;
-        Py_DECREF(id);
         id = id2;
     }
     PyUnicode_InternInPlace(&id);