From 66042e180b1de4d4797d3ba16cf9b2fc53de18d1 Mon Sep 17 00:00:00 2001 From: "Miss Islington (bot)" <31488909+miss-islington@users.noreply.github.com> Date: Wed, 26 Mar 2025 20:01:36 +0100 Subject: [PATCH] [3.12] gh-131762: Fixed dereferencing the pointer 'parser_token->metadata' with a NULL value (GH-131764) (#131775) 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 | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Parser/pegen.c b/Parser/pegen.c index 6ae9bef2160..5b92133d9f9 100644 --- a/Parser/pegen.c +++ b/Parser/pegen.c @@ -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;