forked from python/cpython
-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[3.12] pythongh-123229: Fix valgrind warning by initializing the f-st…
…ring buffers to 0 in the tokenizer (pythonGH-123263) (cherry picked from commit adc5190) Co-authored-by: Pablo Galindo Salgado <[email protected]> Signed-off-by: Pablo Galindo <[email protected]>
- Loading branch information
Showing
3 changed files
with
16 additions
and
1 deletion.
There are no files selected for viewing
2 changes: 2 additions & 0 deletions
2
Misc/NEWS.d/next/Core and Builtins/2024-08-23-13-08-27.gh-issue-123229.aHm-dw.rst
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
Fix valgrind warning by initializing the f-string buffers to 0 in the | ||
tokenizer. Patch by Pablo Galindo |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
diff --git a/Parser/tokenizer.c b/Parser/tokenizer.c | ||
index 3118fb19846..9e0dee8cc38 100644 | ||
--- a/Parser/tokenizer.c | ||
+++ b/Parser/tokenizer.c | ||
@@ -65,7 +65,7 @@ static const char *type_comment_prefix = "# type: "; | ||
|
||
static struct tok_state *tok_new(void) { | ||
struct tok_state *tok = | ||
- (struct tok_state *)PyMem_Malloc(sizeof(struct tok_state)); | ||
+ (struct tok_state *)PyMem_Calloc(1, sizeof(struct tok_state)); | ||
if (tok == NULL) | ||
return NULL; | ||
tok->buf = tok->cur = tok->inp = NULL; |