mirror of
https://github.com/mruby/mruby
synced 2026-06-08 16:11:16 +00:00
Should not deallocate shared string referring static; fix #3373
This commit is contained in:
+1
-1
@@ -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';
|
||||
|
||||
Reference in New Issue
Block a user