Skip to content

Commit 975f3cb

Browse files
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 91e6c87) Co-authored-by: Zackery Spytz <zspytz@gmail.com>
1 parent ef4306b commit 975f3cb

File tree

2 files changed

+2
-0
lines changed

2 files changed

+2
-0
lines changed
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
Fix a memory leak in Modules/timemodule.c. Patch by Zackery Spytz.

Modules/timemodule.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -776,6 +776,7 @@ time_strftime(PyObject *self, PyObject *args)
776776
if (outbuf[1] == L'y' && buf.tm_year < 0) {
777777
PyErr_SetString(PyExc_ValueError,
778778
"format %y requires year >= 1900 on AIX");
779+
PyMem_Free(format);
779780
return NULL;
780781
}
781782
}

0 commit comments

Comments
 (0)