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

Skip to content

Commit 11e0e0c

Browse files
Make path_cleanup() paranoidally safer.
1 parent f386b63 commit 11e0e0c

1 file changed

Lines changed: 2 additions & 1 deletion

File tree

Modules/posixmodule.c

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -901,8 +901,9 @@ static void
901901
path_cleanup(path_t *path)
902902
{
903903
#if !USE_UNICODE_WCHAR_CACHE
904-
PyMem_Free((wchar_t *)path->wide);
904+
wchar_t *wide = (wchar_t *)path->wide;
905905
path->wide = NULL;
906+
PyMem_Free(wide);
906907
#endif /* USE_UNICODE_WCHAR_CACHE */
907908
Py_CLEAR(path->object);
908909
Py_CLEAR(path->cleanup);

0 commit comments

Comments
 (0)