[New-bugs-announce] [issue39307] Memory leak in parsetok

Alex Henrie report at bugs.python.org
Sat Jan 11 15:13:33 EST 2020


New submission from Alex Henrie <alexhenrie24 at 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 <report at bugs.python.org>
<https://bugs.python.org/issue39307>
_______________________________________


More information about the New-bugs-announce mailing list