From 51ace98ae3be09ac3fc86a63e6a0e2fb18155d73 Mon Sep 17 00:00:00 2001 From: Zackery Spytz Date: Wed, 19 Sep 2018 06:59:20 -0600 Subject: [PATCH] bpo-34735: Fix a memory leak in Modules/timemodule.c There was a missing PyMem_Free(format) in time_strftime(). --- .../Core and Builtins/2018-09-19-06-57-34.bpo-34735.-3mrSJ.rst | 1 + Modules/timemodule.c | 1 + 2 files changed, 2 insertions(+) create mode 100644 Misc/NEWS.d/next/Core and Builtins/2018-09-19-06-57-34.bpo-34735.-3mrSJ.rst 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 00000000000000..8de08ec386374e --- /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 1a4cff23d65efd..a1c748658f6550 100644 --- a/Modules/timemodule.c +++ b/Modules/timemodule.c @@ -801,6 +801,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; } }