Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 91e6c87

Browse files
ZackerySpytzserhiy-storchaka
authored andcommitted
bpo-34735: Fix a memory leak in Modules/timemodule.c (GH-9418)
There was a missing PyMem_Free(format) in time_strftime().
1 parent c510c6b commit 91e6c87

2 files changed

Lines changed: 2 additions & 0 deletions

File tree

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
@@ -801,6 +801,7 @@ time_strftime(PyObject *self, PyObject *args)
801801
if (outbuf[1] == L'y' && buf.tm_year < 0) {
802802
PyErr_SetString(PyExc_ValueError,
803803
"format %y requires year >= 1900 on AIX");
804+
PyMem_Free(format);
804805
return NULL;
805806
}
806807
}

0 commit comments

Comments
 (0)