Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Fix a potential GC problem

All tests have now been run with GC.stress = true, so it seems that
we’re now Ruby GC safe.  What a joyous occassion!
  • Loading branch information...
commit eef6f71e70b5952fd0ec7577796f42f50bf84aef 1 parent 1c8aa43
Nikolai Weibull authored
Showing with 3 additions and 3 deletions.
  1. +2 −2 ext/u/rb_u_string.c
  2. +1 −1  ext/u/rb_u_string_aref.c
View
4 ext/u/rb_u_string.c
@@ -48,10 +48,10 @@ static VALUE
rb_u_string_create(VALUE rb, const char *str, long length)
{
struct rb_u_string *string = ALLOC(struct rb_u_string);
+ string->rb = Qnil;
string->c = str;
string->length = length;
- VALUE result = USTRING2RVAL(string);
- return rb_u_string_set_rb(result, rb);
+ return rb_u_string_set_rb(USTRING2RVAL(string), rb);
}
static VALUE
View
2  ext/u/rb_u_string_aref.c
@@ -38,7 +38,7 @@ rb_u_string_subpat(VALUE self, VALUE re, VALUE reference)
if (rb_reg_search(re, StringValue(self), 0, 0) < 0)
return Qnil;
- VALUE match = rb_u_pattern_match_reference(reference);
+ volatile VALUE match = rb_u_pattern_match_reference(reference);
return NIL_P(match) ? Qnil : rb_u_string_new_rb(match);
}
Please sign in to comment.
Something went wrong with that request. Please try again.