Don't print bug report in asan_death_callback when no VM

If we don't have the VM (e.g. printing memory leaks in LSAN after shutdown)
then we will crash when we try to print the bug report. This issue was
reported in: https://github.com/ruby/ruby/pull/12309#issuecomment-2555766525
This commit is contained in:
Peter Zhu 2024-12-20 14:09:19 -05:00
parent aa360c3bee
commit 97f5546676
Notes: git 2024-12-20 20:04:26 +00:00

4
gc.c
View File

@ -940,7 +940,9 @@ ruby_modular_gc_init(void)
static void
asan_death_callback(void)
{
rb_bug_without_die("ASAN error");
if (GET_VM()) {
rb_bug_without_die("ASAN error");
}
}
#endif