From 97f55466760d89a54e82608e5c7c31fba60158ca Mon Sep 17 00:00:00 2001 From: Peter Zhu Date: Fri, 20 Dec 2024 14:09:19 -0500 Subject: 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 --- gc.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) (limited to 'gc.c') diff --git a/gc.c b/gc.c index d504b96497..150450489c 100644 --- a/gc.c +++ b/gc.c @@ -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 -- cgit v1.2.3