Skip to content

Commit adc5190

Browse files
authored
gh-123229: Fix valgrind warning by initializing the f-string buffers to 0 in the tokenizer (#123263)
Signed-off-by: Pablo Galindo <[email protected]>
1 parent 0b0f7be commit adc5190

File tree

2 files changed

+4
-1
lines changed

2 files changed

+4
-1
lines changed
Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
Fix valgrind warning by initializing the f-string buffers to 0 in the
2+
tokenizer. Patch by Pablo Galindo

Parser/lexer/state.c

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,8 @@
1212
struct tok_state *
1313
_PyTokenizer_tok_new(void)
1414
{
15-
struct tok_state *tok = (struct tok_state *)PyMem_Malloc(
15+
struct tok_state *tok = (struct tok_state *)PyMem_Calloc(
16+
1,
1617
sizeof(struct tok_state));
1718
if (tok == NULL)
1819
return NULL;

0 commit comments

Comments
 (0)