You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
PyInitConfig_Free() doesn't release memory allocated by PyInitConfig_SetStr() #138756
When building Python with address sanitizer ./configure --with-pydebug --with-address-sanitizer CFLAGS="-O0", the build fails with the following error:
==768783==ERROR: LeakSanitizer: detected memory leaks
Direct leak of 68 byte(s) in 1 object(s) allocated from:
#0 0x7fd85a0e6f2b in malloc (/lib64/libasan.so.8+0xe6f2b) (BuildId: 10b8ccd49f75c21babf1d7abe51bb63589d8471f)
#1 0x000000a8a258 in utf8_to_wstr Python/initconfig.c:4054
#2 0x000000a8a643 in PyInitConfig_SetStr Python/initconfig.c:4088
#3 0x00000040238d in runtime_init Programs/_freeze_module.c:57
#4 0x0000004030ee in main Programs/_freeze_module.c:237
#5 0x7fd859e11574 in __libc_start_call_main (/lib64/libc.so.6+0x3574) (BuildId: 48c4b9b1efb1df15da8e787f489128bf31893317)
#6 0x7fd859e11627 in __libc_start_main@GLIBC_2.2.5 (/lib64/libc.so.6+0x3627) (BuildId: 48c4b9b1efb1df15da8e787f489128bf31893317)
#7 0x000000401eb4 in _start (/home/vstinner/python/main/Programs/_freeze_module+0x401eb4) (BuildId: 871b1eb54b816428317fe79f8100da96490cf4fc)
SUMMARY: AddressSanitizer: 68 byte(s) leaked in 1 allocation(s).
make: *** [Makefile:1937: Python/frozen_modules/importlib._bootstrap_external.h] Error 1
The problem is that the PyInitConfig C API leaks memory. PyInitConfig_Free() doesn't release memory allocated by PyInitConfig_SetStr().
Activity
pythongh-138756: Fix memory leak in PyInitConfig_Free()
gh-138756: Fix memory leak in PyInitConfig_Free() (#138759)
pythongh-138756: Fix memory leak in PyInitConfig_Free() (pythonGH-138759
pythongh-138756: Fix another leak in PyInitConfig_Free()
gh-138756: Fix leak of inittab memory in PyInitConfig_Free() (GH-138792)
[3.14] gh-138756: Fix memory leak in PyInitConfig_Free() (GH-138759) (#…
pythongh-138756: Fix leak of inittab memory in PyInitConfig_Free() (p…
[3.14] gh-138756: Fix leak of inittab memory in PyInitConfig_Free() (G…