Fix array replace leak error in mruby-uri.
MODIFY
src/array.c
src/array.c
@@ -377,6 +377,9 @@ ary_replace(mrb_state *mrb, struct RArray *a, struct RArray *b)
if (ARY_EMBED_P(a)) {
ARY_UNSET_EMBED_FLAG(a);
}
+ else {
+ mrb_free(mrb, a->as.heap.ptr);
+ }
a->as.heap.ptr = b->as.heap.ptr;
a->as.heap.len = len;
a->as.heap.aux.shared = b->as.heap.aux.shared;

MODIFY
test/t/array.rb
test/t/array.rb
@@ -392,3 +392,10 @@ assert('Array#freeze') do
a[0] = 1
end
end
+
+assert('shared array replace') do
+ a = [0] * 40
+ b = [0, 1, 2]
+ b.replace a[1, 20].dup
+ assert_equal 20, b.size
+end

Fix array replace leak error in mruby-uri.