summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMiss Islington (bot) <31488909+miss-islington@users.noreply.github.com>2018-09-21 00:41:50 -0700
committerGitHub <noreply@github.com>2018-09-21 00:41:50 -0700
commit975f3cb1f25406a9be019906227d53b23852f415 (patch)
treec31e1021ead85f03381673fba5db4f447efabaf5
parentef4306b24c9034d6b37bb034e2ebe82e745d4b77 (diff)
downloadcpython-git-975f3cb1f25406a9be019906227d53b23852f415.tar.gz
bpo-34735: Fix a memory leak in Modules/timemodule.c (GH-9418)
There was a missing PyMem_Free(format) in time_strftime(). (cherry picked from commit 91e6c8717b7dcbcc46b189509de5f2d335819f37) Co-authored-by: Zackery Spytz <zspytz@gmail.com>
-rw-r--r--Misc/NEWS.d/next/Core and Builtins/2018-09-19-06-57-34.bpo-34735.-3mrSJ.rst1
-rw-r--r--Modules/timemodule.c1
2 files changed, 2 insertions, 0 deletions
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
index 0000000000..8de08ec386
--- /dev/null
+++ b/Misc/NEWS.d/next/Core and Builtins/2018-09-19-06-57-34.bpo-34735.-3mrSJ.rst
@@ -0,0 +1 @@
+Fix a memory leak in Modules/timemodule.c. Patch by Zackery Spytz.
diff --git a/Modules/timemodule.c b/Modules/timemodule.c
index dbe2fbaf07..7264ad6167 100644
--- a/Modules/timemodule.c
+++ b/Modules/timemodule.c
@@ -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;
}
}