mirror of
https://github.com/python/cpython.git
synced 2025-10-09 16:34:44 +00:00
bpo-36301: Fix Py_Main() memory leaks (GH-12420)
bpo-36301, bpo-36333: * Fix memory allocator used by _PyPathConfig_ClearGlobal(): force the default allocator. * _PyPreConfig_ReadFromArgv(): free init_ctype_locale memory. * pymain_main(): call pymain_free() on init error Co-Authored-By: Stéphane Wirtel <stephane@wirtel.be>
This commit is contained in:
parent
a10d426bab
commit
c183444f7e
3 changed files with 12 additions and 2 deletions
|
@ -149,7 +149,12 @@ done:
|
|||
void
|
||||
_PyPathConfig_ClearGlobal(void)
|
||||
{
|
||||
PyMemAllocatorEx old_alloc;
|
||||
_PyMem_SetDefaultAllocator(PYMEM_DOMAIN_RAW, &old_alloc);
|
||||
|
||||
_PyPathConfig_Clear(&_Py_path_config);
|
||||
|
||||
PyMem_SetAllocator(PYMEM_DOMAIN_RAW, &old_alloc);
|
||||
}
|
||||
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue