bpo-34735: Fix a memory leak in Modules/timemodule.c#9418
Conversation
There was a missing PyMem_Free(format) in time_strftime().
|
The actual fix here looks good to me, but I am fairly sure that this code is not hit by any of the tests, so I recommend adding a test that hits there. I think adding this to @unittest.skipif(not (sys.platform.startswith('aix') or
sys.platform.startswith('win'))
"%y on Windows and AIX doesn't support years < 1900")
def test_strftime_aixwin_pre1900(self):
d = self.theclass(1, 1, 1)
self.assertRaises(ValueError, d.strftime, '%y') |
|
@pganssle This code is hit in |
|
@ZackerySpytz Ah, tricky tricky. There's a bunch of strftime-related tests in |
|
Thanks for the patch, @ZackerySpytz ! I'm not sure if my label adding and removing messed up our auto-merge. If it did I will try to merge this tomorrow. |
|
Thanks @ZackerySpytz for the PR, and @serhiy-storchaka for merging it 🌮🎉.. I'm working now to backport this PR to: 3.6, 3.7. |
There was a missing PyMem_Free(format) in time_strftime(). (cherry picked from commit 91e6c87) Co-authored-by: Zackery Spytz <zspytz@gmail.com>
|
GH-9469 is a backport of this pull request to the 3.7 branch. |
There was a missing PyMem_Free(format) in time_strftime(). (cherry picked from commit 91e6c87) Co-authored-by: Zackery Spytz <zspytz@gmail.com>
|
GH-9470 is a backport of this pull request to the 3.6 branch. |
|
Thank you, @brettcannon and @serhiy-storchaka. |
The format string was not being freed when
ValueErrorwas raised for%yon certain platforms.