From 0247e80f3c529900689425676342cb70ea31a13d Mon Sep 17 00:00:00 2001 From: Eddie Elizondo Date: Sat, 14 Sep 2019 09:38:17 -0400 Subject: Fix leaks in Python-ast.c (#16127) --- Python/Python-ast.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) (limited to 'Python/Python-ast.c') diff --git a/Python/Python-ast.c b/Python/Python-ast.c index 5190a90f13..7a38e98c43 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 -- cgit v1.2.1