Permalink
Browse files

Should not deallocate shared string referring static; fix #3373

  • Loading branch information...
matz committed Jan 6, 2017
1 parent 36f5b44 commit f53f73f30ca390d27994e9092ff9b6b18aa615bf
Showing with 1 addition and 1 deletion.
  1. +1 −1 src/string.c
View
@@ -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';

0 comments on commit f53f73f

Please sign in to comment.