From adc5190014efcf7b7a4c5dfc9998faa8345527ed Mon Sep 17 00:00:00 2001 From: Pablo Galindo Salgado Date: Fri, 23 Aug 2024 13:33:45 +0100 Subject: gh-123229: Fix valgrind warning by initializing the f-string buffers to 0 in the tokenizer (#123263) Signed-off-by: Pablo Galindo --- .../Core and Builtins/2024-08-23-13-08-27.gh-issue-123229.aHm-dw.rst | 2 ++ Parser/lexer/state.c | 3 ++- 2 files changed, 4 insertions(+), 1 deletion(-) create mode 100644 Misc/NEWS.d/next/Core and Builtins/2024-08-23-13-08-27.gh-issue-123229.aHm-dw.rst diff --git a/Misc/NEWS.d/next/Core and Builtins/2024-08-23-13-08-27.gh-issue-123229.aHm-dw.rst b/Misc/NEWS.d/next/Core and Builtins/2024-08-23-13-08-27.gh-issue-123229.aHm-dw.rst new file mode 100644 index 0000000..aa9e8d1 --- /dev/null +++ b/Misc/NEWS.d/next/Core and Builtins/2024-08-23-13-08-27.gh-issue-123229.aHm-dw.rst @@ -0,0 +1,2 @@ +Fix valgrind warning by initializing the f-string buffers to 0 in the +tokenizer. Patch by Pablo Galindo diff --git a/Parser/lexer/state.c b/Parser/lexer/state.c index 647f291..1665deb 100644 --- a/Parser/lexer/state.c +++ b/Parser/lexer/state.c @@ -12,7 +12,8 @@ struct tok_state * _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)); if (tok == NULL) return NULL; -- cgit v0.12