ruby/ruby-3.0.0-Do-not-allocate-ractor-local-storage-in-dfree-function-during-GC.patch
DistroBaker 074531b193 Merged update from upstream sources
This is an automated DistroBaker update from upstream sources.
If you do not know what this is about or would like to opt out,
contact the OSCI team.

Source: https://src.fedoraproject.org/rpms/ruby.git#9b149e59e4a46bdfebd0a7fd1a865d16c1c66886
2021-03-11 20:11:39 +00:00

25 lines
664 B
Diff

From 265c0022390e3dcd4ff692fc77d29b94e652c877 Mon Sep 17 00:00:00 2001
From: Nobuyoshi Nakada <nobu@ruby-lang.org>
Date: Tue, 9 Feb 2021 01:00:00 +0900
Subject: [PATCH] Do not allocate ractor-local storage in dfree function during
GC
---
random.c | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/random.c b/random.c
index c11cd803f2cb..83df6d1eb537 100644
--- a/random.c
+++ b/random.c
@@ -257,7 +257,8 @@ const rb_data_type_t rb_random_data_type = {
static void
random_mt_free(void *ptr)
{
- if (ptr != default_rand())
+ rb_random_mt_t *rnd = rb_ractor_local_storage_ptr(default_rand_key);
+ if (ptr != rnd)
xfree(ptr);
}