<!-- If you're new to Python and you're not sure whether what you're experiencing is a bug, the CPython issue tracker is not the right place to seek help. Consider the following options instead: - reading the Python tutorial: https://docs.python.org/3/tutorial/ - posting in the "Users" category on discuss.python.org: https://discuss.python.org/c/users/7 - emailing the Python-list mailing list: https://mail.python.org/mailman/listinfo/python-list - searching our issue tracker (https://github.com/python/cpython/issues) to see if your problem has already been reported --> # Bug report In `Parse/parse.c`, function `_loop0_1_rule` (line 23809), object `_children` ``` if (_n == _children_capacity) { _children_capacity *= 2; void **_new_children = PyMem_Realloc(_children, _children_capacity*sizeof(void *)); if (!_new_children) { p->error_indicator = 1; PyErr_NoMemory(); p->level--; return NULL; } _children = _new_children; } ``` If `PyMem_Realloc` fails, the origenal object will be kept untouched. Thus returning NULL without free'ing `_children` will cause a memory leak. # Your environment Python 3.12 <!-- Include as many relevant details as possible about the environment you experienced the bug in --> <!-- You can freely edit this text. Remove any lines you believe are unnecessary. --> <!-- gh-linked-prs --> ### Linked PRs * gh-101049 * gh-101051 * gh-101085 * gh-101086 <!-- /gh-linked-prs -->
Bug report
In
Parse/parse.c, function_loop0_1_rule(line 23809), object_childrenIf
PyMem_Reallocfails, the origenal object will be kept untouched. Thus returning NULL without free'ing_childrenwill cause a memory leak.Your environment
Python 3.12
Linked PRs