]> 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:50 +0000 (00:41 -0700)
committerGitHub <noreply@github.com>
Fri, 21 Sep 2018 07:41:50 +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 dbe2fbaf07967c55c480775ce72b2e339a85ae3b..7264ad6167008e072d3cd03be1a198ffd7ca7ff1 100644 (file)
@@ -776,6 +776,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;
         }
     }