summaryrefslogtreecommitdiffstats
path: root/string.c
diff options
context:
space:
mode:
authorakr <akr@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2007-12-13 11:52:15 +0000
committerakr <akr@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2007-12-13 11:52:15 +0000
commit746d8bb0033bb8e36ddccca0468a582cb95e441b (patch)
treeeb27cc82ab0c9674639ba858812f2432320b1019 /string.c
parented49617bb09f911aaf09fa46958e6ff75c1f0b1f (diff)
downloadruby-746d8bb0033bb8e36ddccca0468a582cb95e441b.tar.gz
ruby-746d8bb0033bb8e36ddccca0468a582cb95e441b.tar.xz
ruby-746d8bb0033bb8e36ddccca0468a582cb95e441b.zip
* string.c (rb_str_shared_replace): make str noembed after free.
git-svn-id: http://svn.ruby-lang.org/repos/ruby/trunk@14215 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'string.c')
-rw-r--r--string.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/string.c b/string.c
index 2ab808281..edbc8d6d6 100644
--- a/string.c
+++ b/string.c
@@ -402,10 +402,10 @@ rb_str_shared_replace(VALUE str, VALUE str2)
STR_SET_EMBED_LEN(str, RSTRING_LEN(str2));
return;
}
- STR_SET_NOEMBED(str);
if (!STR_SHARED_P(str) && !STR_EMBED_P(str)) {
free(RSTRING_PTR(str));
}
+ STR_SET_NOEMBED(str);
STR_UNSET_NOCAPA(str);
RSTRING(str)->as.heap.ptr = RSTRING_PTR(str2);
RSTRING(str)->as.heap.len = RSTRING_LEN(str2);