]> git.ipfire.org Git - thirdparty/Python/cpython.git/commitdiff
[3.12] gh-131762: Fixed dereferencing the pointer 'parser_token->metadata' with a...
authorMiss Islington (bot) <31488909+miss-islington@users.noreply.github.com>
Wed, 26 Mar 2025 19:01:36 +0000 (20:01 +0100)
committerGitHub <noreply@github.com>
Wed, 26 Mar 2025 19:01:36 +0000 (19:01 +0000)
gh-131762: Fixed dereferencing the pointer 'parser_token->metadata' with a NULL value (GH-131764)
(cherry picked from commit 2c686a9ac243800b630d4a09622c8eb789f5b354)

Co-authored-by: rialbat <47256826+rialbat@users.noreply.github.com>
Parser/pegen.c

index 6ae9bef2160d07c11c6f4196c094cea4a307d833..5b92133d9f905b52c072610a48b07ecd62becccf 100644 (file)
@@ -244,7 +244,7 @@ initialize_token(Parser *p, Token *parser_token, struct token *new_token, int to
     parser_token->metadata = NULL;
     if (new_token->metadata != NULL) {
         if (_PyArena_AddPyObject(p->arena, new_token->metadata) < 0) {
-            Py_DECREF(parser_token->metadata);
+            Py_DECREF(new_token->metadata);
             return -1;
         }
         parser_token->metadata = new_token->metadata;