]> git.ipfire.org Git - thirdparty/Python/cpython.git/commitdiff
[3.13] gh-123229: Fix valgrind warning by initializing the f-string buffers to 0...
authorMiss Islington (bot) <31488909+miss-islington@users.noreply.github.com>
Fri, 23 Aug 2024 12:59:54 +0000 (14:59 +0200)
committerGitHub <noreply@github.com>
Fri, 23 Aug 2024 12:59:54 +0000 (12:59 +0000)
gh-123229: Fix valgrind warning by initializing the f-string buffers to 0 in the tokenizer (GH-123263)
(cherry picked from commit adc5190014efcf7b7a4c5dfc9998faa8345527ed)

Signed-off-by: Pablo Galindo <pablogsal@gmail.com>
Co-authored-by: Pablo Galindo Salgado <Pablogsal@gmail.com>
Misc/NEWS.d/next/Core and Builtins/2024-08-23-13-08-27.gh-issue-123229.aHm-dw.rst [new file with mode: 0644]
Parser/lexer/state.c

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 (file)
index 0000000..aa9e8d1
--- /dev/null
@@ -0,0 +1,2 @@
+Fix valgrind warning by initializing the f-string buffers to 0 in the
+tokenizer. Patch by Pablo Galindo
index 647f291911564c45809196ad1642e104b4086feb..1665debea30b3017a9304780cdc9a1030d44dac8 100644 (file)
@@ -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;