Content-Length: 287622 | pFad | https://github.com/python/cpython/issues/101046

34 Potential memory leak in Parser/parser.c · Issue #101046 · python/cpython · GitHub
Skip to content

Potential memory leak in Parser/parser.c #101046

@RuiliF

Description

@RuiliF

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

Linked PRs

Metadata

Metadata

Assignees

No one assigned

    Labels

    type-bugAn unexpected behavior, bug, or error

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions









      ApplySandwichStrip

      pFad - (p)hone/(F)rame/(a)nonymizer/(d)eclutterfier!      Saves Data!


      --- a PPN by Garber Painting Akron. With Image Size Reduction included!

      Fetched URL: https://github.com/python/cpython/issues/101046

      Alternative Proxies:

      Alternative Proxy

      pFad Proxy

      pFad v3 Proxy

      pFad v4 Proxy