From 746d8bb0033bb8e36ddccca0468a582cb95e441b Mon Sep 17 00:00:00 2001 From: akr Date: Thu, 13 Dec 2007 11:52:15 +0000 Subject: * 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 --- string.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'string.c') 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); -- cgit