summaryrefslogtreecommitdiffstats
path: root/array.c
diff options
context:
space:
mode:
authormatz <matz@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2006-10-11 08:01:25 +0000
committermatz <matz@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2006-10-11 08:01:25 +0000
commitedff9984e57ca26cde9b925ac04c098e100909c8 (patch)
treec47a23c4fe97cc39fb533f286d43444ff426807b /array.c
parent320d9954189d09a2501e360fcd74a06e5be92892 (diff)
downloadruby-edff9984e57ca26cde9b925ac04c098e100909c8.tar.gz
ruby-edff9984e57ca26cde9b925ac04c098e100909c8.tar.xz
ruby-edff9984e57ca26cde9b925ac04c098e100909c8.zip
* array.c (rb_ary_replace): should shift lfree pointer before
calling xfree. git-svn-id: http://svn.ruby-lang.org/repos/ruby/trunk@11128 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'array.c')
-rw-r--r--array.c6
1 files changed, 5 insertions, 1 deletions
diff --git a/array.c b/array.c
index e488b556d..d4957a95b 100644
--- a/array.c
+++ b/array.c
@@ -2158,7 +2158,11 @@ rb_ary_replace(VALUE copy, VALUE orig)
ARY_SET_NOEMBED(copy);
}
else {
- xfree(RARRAY(copy)->as.heap.ptr);
+ VALUE *ptr = RARRAY(copy)->as.heap.ptr;
+ if (ARY_LFREE_P(copy)) {
+ ptr -= LFREE_SIZE(copy);
+ }
+ xfree(ptr);
}
RARRAY(copy)->as.heap.ptr = RARRAY(shared)->as.heap.ptr;
RARRAY(copy)->as.heap.len = RARRAY(shared)->as.heap.len;