summaryrefslogtreecommitdiff
path: root/string.c
diff options
context:
space:
mode:
Diffstat (limited to 'string.c')
-rw-r--r--string.c3
1 files changed, 2 insertions, 1 deletions
diff --git a/string.c b/string.c
index 220f6f1bfb..0af0be0d09 100644
--- a/string.c
+++ b/string.c
@@ -105,7 +105,8 @@ str_assign(str, str2)
VALUE str, str2;
{
if (NIL_P(str2) || str == str2) return;
- free(RSTRING(str)->ptr);
+ if (!RSTRING(str)->orig && RSTRING(str)->ptr)
+ free(RSTRING(str)->ptr);
RSTRING(str)->ptr = RSTRING(str2)->ptr;
RSTRING(str)->len = RSTRING(str2)->len;
RSTRING(str)->orig = RSTRING(str2)->orig;