]> git.ipfire.org Git - thirdparty/Python/cpython.git/commitdiff
gh-123229: Fix valgrind warning by initializing the f-string buffers to 0 in the...
authorPablo Galindo Salgado <Pablogsal@gmail.com>
Fri, 23 Aug 2024 12:33:45 +0000 (13:33 +0100)
committerGitHub <noreply@github.com>
Fri, 23 Aug 2024 12:33:45 +0000 (12:33 +0000)
Signed-off-by: Pablo Galindo <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;