@@ -307,13 +307,15 @@ rb_current_namespace_details(VALUE opt)
307307 RSTRING_PTR (part ),
308308 th -> namespaces ? RARRAY_LEN (th -> namespaces ) : 0 ,
309309 require_stack ? RARRAY_LEN (require_stack ) : 0 );
310+ RB_GC_GUARD (part );
310311 rb_str_cat_cstr (str , buf );
311312
312313 if (th -> namespaces && RARRAY_LEN (th -> namespaces ) > 0 ) {
313314 for (i = 0 ; i < RARRAY_LEN (th -> namespaces ); i ++ ) {
314315 nsobj = RARRAY_AREF (th -> namespaces , i );
315316 part = rb_namespace_inspect (nsobj );
316317 snprintf (buf , 2048 , " th->nss[%ld] %s\n" , i , RSTRING_PTR (part ));
318+ RB_GC_GUARD (part );
317319 rb_str_cat_cstr (str , buf );
318320 }
319321 }
@@ -331,6 +333,7 @@ rb_current_namespace_details(VALUE opt)
331333 if (NAMESPACE_USER_P (ns )) {
332334 part = rb_namespace_inspect (proc_ns -> ns_object );
333335 snprintf (buf , 2048 , " cfp->ns:%s" , RSTRING_PTR (part ));
336+ RB_GC_GUARD (part );
334337 calling = 0 ;
335338 break ;
336339 }
@@ -350,6 +353,7 @@ rb_current_namespace_details(VALUE opt)
350353 rb_id2name (cme -> def -> original_id ),
351354 RSTRING_PTR (part ),
352355 path );
356+ RB_GC_GUARD (part );
353357 rb_str_cat_cstr (str , buf );
354358 calling = 0 ;
355359 break ;
@@ -359,6 +363,7 @@ rb_current_namespace_details(VALUE opt)
359363 rb_id2name (cme -> def -> original_id ),
360364 RSTRING_PTR (part ),
361365 path );
366+ RB_GC_GUARD (part );
362367 rb_str_cat_cstr (str , buf );
363368 }
364369 }
0 commit comments