summaryrefslogtreecommitdiffstats
path: root/Parser
diff options
context:
space:
mode:
authorEddie Elizondo <eelizondo@fb.com>2019-09-14 13:38:17 (GMT)
committerDino Viehland <dinoviehland@gmail.com>2019-09-14 13:38:17 (GMT)
commit0247e80f3c529900689425676342cb70ea31a13d (patch)
treeffc687b49ea5d6fef86a58b577fb6198229322e5 /Parser
parent279f44678c8b84a183f9eeb85e0b086228154497 (diff)
downloadcpython-0247e80f3c529900689425676342cb70ea31a13d.zip
cpython-0247e80f3c529900689425676342cb70ea31a13d.tar.gz
cpython-0247e80f3c529900689425676342cb70ea31a13d.tar.bz2
Fix leaks in Python-ast.c (#16127)
Diffstat (limited to 'Parser')
-rwxr-xr-xParser/asdl_c.py6
1 files changed, 5 insertions, 1 deletions
diff --git a/Parser/asdl_c.py b/Parser/asdl_c.py
index 6b31ffd8..0b72f9e 100755
--- a/Parser/asdl_c.py
+++ b/Parser/asdl_c.py
@@ -638,9 +638,13 @@ static void
ast_dealloc(AST_object *self)
{
/* bpo-31095: UnTrack is needed before calling any callbacks */
+ PyTypeObject *tp = Py_TYPE(self);
PyObject_GC_UnTrack(self);
Py_CLEAR(self->dict);
- Py_TYPE(self)->tp_free(self);
+ freefunc free_func = PyType_GetSlot(tp, Py_tp_free);
+ assert(free_func != NULL);
+ free_func(self);
+ Py_DECREF(tp);
}
static int