aboutsummaryrefslogtreecommitdiffstats
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 a7c88a55a0..32adcfd392 100644
--- a/string.c
+++ b/string.c
@@ -2347,7 +2347,7 @@ static VALUE
rb_str_clear(VALUE str)
{
/* rb_str_modify() */ /* no need for str_make_independent */
- if (str_independent(str)) {
+ if (str_independent(str) && !STR_EMBED_P(str)) {
free(RSTRING_PTR(str));
}
STR_SET_EMBED(str);