diff options
author | Eddie Elizondo <eelizondo@fb.com> | 2019-09-14 13:38:17 (GMT) |
---|---|---|
committer | Dino Viehland <dinoviehland@gmail.com> | 2019-09-14 13:38:17 (GMT) |
commit | 0247e80f3c529900689425676342cb70ea31a13d (patch) | |
tree | ffc687b49ea5d6fef86a58b577fb6198229322e5 /Parser | |
parent | 279f44678c8b84a183f9eeb85e0b086228154497 (diff) | |
download | cpython-0247e80f3c529900689425676342cb70ea31a13d.zip cpython-0247e80f3c529900689425676342cb70ea31a13d.tar.gz cpython-0247e80f3c529900689425676342cb70ea31a13d.tar.bz2 |
Fix leaks in Python-ast.c (#16127)
Diffstat (limited to 'Parser')
-rwxr-xr-x | Parser/asdl_c.py | 6 |
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 |