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

Signed-off-by: Pablo Galindo <pablogsal@gmail.com>
This commit is contained in:
Pablo Galindo Salgado 2024-08-23 13:33:45 +01:00 committed by GitHub
parent 0b0f7befad
commit adc5190014
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;