Skip to content

Commit

Permalink
Fix leaks in Python-ast.c (python#16127)
Browse files Browse the repository at this point in the history
  • Loading branch information
eduardo-elizondo authored and DinoV committed Sep 14, 2019
1 parent 279f446 commit 0247e80
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 2 deletions.
6 changes: 5 additions & 1 deletion Parser/asdl_c.py
Original file line number Diff line number Diff line change
Expand Up @@ -638,9 +638,13 @@ def visitModule(self, mod):
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
Expand Down
6 changes: 5 additions & 1 deletion Python/Python-ast.c

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

0 comments on commit 0247e80

Please sign in to comment.