[3.13] gh-123229: Fix valgrind warning by initializing the f-string buffers to 0 in the tokenizer (GH-123263) (#123264)

gh-123229: Fix valgrind warning by initializing the f-string buffers to 0 in the tokenizer (GH-123263)
(cherry picked from commit adc5190014)

Signed-off-by: Pablo Galindo <pablogsal@gmail.com>
Co-authored-by: Pablo Galindo Salgado <Pablogsal@gmail.com>
This commit is contained in:
Miss Islington (bot) 2024-08-23 14:59:54 +02:00 committed by GitHub
parent 0955db1bd8
commit 935b8b422b
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 4 additions and 1 deletions

View File

@ -0,0 +1,2 @@
Fix valgrind warning by initializing the f-string buffers to 0 in the
tokenizer. Patch by Pablo Galindo

View File

@ -12,7 +12,8 @@
struct tok_state * struct tok_state *
_PyTokenizer_tok_new(void) _PyTokenizer_tok_new(void)
{ {
struct tok_state *tok = (struct tok_state *)PyMem_Malloc( struct tok_state *tok = (struct tok_state *)PyMem_Calloc(
1,
sizeof(struct tok_state)); sizeof(struct tok_state));
if (tok == NULL) if (tok == NULL)
return NULL; return NULL;