diff options
| author | Nobuyoshi Nakada <nobu@ruby-lang.org> | 2025-11-08 10:17:07 +0900 |
|---|---|---|
| committer | Nobuyoshi Nakada <nobu@ruby-lang.org> | 2025-11-08 10:17:07 +0900 |
| commit | c65f8b6370f5ef692148786b5e8de54c4d14c132 (patch) | |
| tree | e516fed1bbb55db26071818945660bc346b63359 | |
| parent | 3b588dab91f13b32b54cb1b9dedb9691e732c981 (diff) | |
Prevent the path for copied extension from GC
| -rw-r--r-- | load.c | 5 |
1 files changed, 4 insertions, 1 deletions
@@ -1207,7 +1207,10 @@ load_ext(VALUE path, VALUE fname) loaded = rb_box_local_extension(box->box_object, fname, path); } rb_scope_visibility_set(METHOD_VISI_PUBLIC); - return (VALUE)dln_load_feature(RSTRING_PTR(loaded), RSTRING_PTR(fname)); + void *handle = dln_load_feature(RSTRING_PTR(loaded), RSTRING_PTR(fname)); + RB_GC_GUARD(loaded); + RB_GC_GUARD(fname); + return (VALUE)handle; } static VALUE |
