summaryrefslogtreecommitdiffstats
path: root/string.c
diff options
context:
space:
mode:
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);