summaryrefslogtreecommitdiffhomepage
path: root/src
diff options
context:
space:
mode:
authorYukihiro "Matz" Matsumoto <[email protected]>2017-01-06 14:25:01 +0900
committerYukihiro "Matz" Matsumoto <[email protected]>2017-01-06 14:25:01 +0900
commitf53f73f30ca390d27994e9092ff9b6b18aa615bf (patch)
treefe745e4f78a70d5317e3dc22c65c82292deaa78d /src
parent36f5b44578791a12619c189808dbc3cb4758e32a (diff)
downloadmruby-f53f73f30ca390d27994e9092ff9b6b18aa615bf.tar.gz
mruby-f53f73f30ca390d27994e9092ff9b6b18aa615bf.zip
Should not deallocate shared string referring static; fix #3373
Diffstat (limited to 'src')
-rw-r--r--src/string.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/src/string.c b/src/string.c
index ae2e5ccc8..d011f60ca 100644
--- a/src/string.c
+++ b/src/string.c
@@ -669,7 +669,7 @@ mrb_str_modify(mrb_state *mrb, struct RString *s)
if (RSTR_SHARED_P(s)) {
mrb_shared_string *shared = s->as.heap.aux.shared;
- if (shared->refcnt == 1 && s->as.heap.ptr == shared->ptr) {
+ if (shared->nofree == 0 && shared->refcnt == 1 && s->as.heap.ptr == shared->ptr) {
s->as.heap.ptr = shared->ptr;
s->as.heap.aux.capa = shared->len;
RSTR_PTR(s)[s->as.heap.len] = '\0';