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 /Python | |
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 'Python')
-rw-r--r-- | Python/Python-ast.c | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/Python/Python-ast.c b/Python/Python-ast.c index 5190a90..7a38e98 100644 --- a/Python/Python-ast.c +++ b/Python/Python-ast.c @@ -1130,9 +1130,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 |