Should not deallocate shared string referring static; fix #3373

This commit is contained in:
Yukihiro "Matz" Matsumoto
2017-01-06 14:25:01 +09:00
parent 36f5b44578
commit f53f73f30c
+1 -1
View File
@@ -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';