player/lua: fix autofree ctx leak on exit() call
Fixes LSAN leak when tests call fail() and exit(1) is called. We have
mpv_destroy set for atexit but data.ctx was null parented, so it had no
parent to be freed by. Parent it to script_ctx instead so it gets
cleaned up by mpv_destroy.
LSAN output:
Direct leak of 400 byte(s) in 5 object(s) allocated from:
#\0 0x7f4c6c52c01f in malloc (/lib64/libasan.so.8+0x12c01f) (BuildId: db0aa5bf57ed53a5869a3a2cc49051292ceb6390)
#\1 0x7f4c6b276388 in ta_alloc_size ../ta/ta.c:139
#\2 0x7f4c6b2bf01f in script_autofree_trampoline ../player/lua.c:1310
#\3 0x7f4c69373b15 (/lib64/libluajit-5.1.so.2+0xbb15) (BuildId: 182622c63dea3dd74173bbd5a810051a76bcf4d9) L
llyyr committed
948c86d24c8a5fcda6706c085bc9218b91bfc6b3
Parent: ce71cd8
Committed by Kacper Michajłow <kasper93@gmail.com>
on 5/3/2026, 3:25:17 PM