diff --git a/ext/digest/digest.c b/ext/digest/digest.c index 239fe7cb10..a02eb12cd6 100644 --- a/ext/digest/digest.c +++ b/ext/digest/digest.c @@ -124,6 +124,8 @@ hexencode_str_new(VALUE str_digest) p[i + i + 1] = hex[byte & 0x0f]; } + RB_GC_GUARD(str_digest); + return str; } @@ -623,6 +625,7 @@ rb_digest_base_update(VALUE self, VALUE str) StringValue(str); algo->update_func(pctx, (unsigned char *)RSTRING_PTR(str), RSTRING_LEN(str)); + RB_GC_GUARD(str); return self; }