Skip to content

Commit

Permalink
Fix a potential GC problem
Browse files Browse the repository at this point in the history
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
Nikolai Weibull committed Apr 6, 2013
1 parent 1c8aa43 commit eef6f71
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
4 changes: 2 additions & 2 deletions ext/u/rb_u_string.c
Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion ext/u/rb_u_string_aref.c
Expand Up @@ -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);
}
Expand Down

0 comments on commit eef6f71

Please sign in to comment.