]> git.ipfire.org Git - thirdparty/Python/cpython.git/commitdiff
bpo-34735: Fix a memory leak in Modules/timemodule.c (GH-9418)
authorMiss Islington (bot) <31488909+miss-islington@users.noreply.github.com>
Fri, 21 Sep 2018 07:41:42 +0000 (00:41 -0700)
committerGitHub <noreply@github.com>
Fri, 21 Sep 2018 07:41:42 +0000 (00:41 -0700)
There was a missing PyMem_Free(format) in time_strftime().
(cherry picked from commit 91e6c8717b7dcbcc46b189509de5f2d335819f37)

Co-authored-by: Zackery Spytz <zspytz@gmail.com>
Misc/NEWS.d/next/Core and Builtins/2018-09-19-06-57-34.bpo-34735.-3mrSJ.rst [new file with mode: 0644]
Modules/timemodule.c

diff --git a/Misc/NEWS.d/next/Core and Builtins/2018-09-19-06-57-34.bpo-34735.-3mrSJ.rst b/Misc/NEWS.d/next/Core and Builtins/2018-09-19-06-57-34.bpo-34735.-3mrSJ.rst
new file mode 100644 (file)
index 0000000..8de08ec
--- /dev/null
@@ -0,0 +1 @@
+Fix a memory leak in Modules/timemodule.c.  Patch by Zackery Spytz.
index 05c4cbcb9c81d268e0afa3ce5cc84ef1c86802b4..f66f098740b29574eb564fd25f21952a9b48ba7c 100644 (file)
@@ -654,6 +654,7 @@ time_strftime(PyObject *self, PyObject *args)
         if (outbuf[1] == L'y' && buf.tm_year < 0) {
             PyErr_SetString(PyExc_ValueError,
                             "format %y requires year >= 1900 on AIX");
+            PyMem_Free(format);
             return NULL;
         }
     }