New submission from Alex Henrie <alexhenri...@gmail.com>:

The parsetok function currently contains the following code:

    if (!growable_comment_array_init(&type_ignores, 10)) {
        err_ret->error = E_NOMEM;
        PyTokenizer_Free(tok);
        return NULL;
    }

    if ((ps = PyParser_New(g, start)) == NULL) {
        err_ret->error = E_NOMEM;
        PyTokenizer_Free(tok);
        return NULL;
    }

If PyParser_New fails, there is a memory leak because 
growable_comment_array_deallocate is not called on type_ignores.

----------
components: Interpreter Core
messages: 359821
nosy: alex.henrie
priority: normal
severity: normal
status: open
title: Memory leak in parsetok
type: resource usage
versions: Python 3.9

_______________________________________
Python tracker <rep...@bugs.python.org>
<https://bugs.python.org/issue39307>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com

Reply via email to