mirror of
https://github.com/mruby/mruby
synced 2026-06-08 16:11:16 +00:00
should always initialize header flags for pooled strings
This commit is contained in:
+1
-1
@@ -174,6 +174,7 @@ mrb_str_pool(mrb_state *mrb, mrb_value str)
|
||||
ns->as.heap.aux.capa = 0;
|
||||
}
|
||||
else {
|
||||
ns->flags = 0;
|
||||
if (s->flags & MRB_STR_EMBED) {
|
||||
ptr = s->as.ary;
|
||||
len = (mrb_int)((s->flags & MRB_STR_EMBED_LEN_MASK) >> MRB_STR_EMBED_LEN_SHIFT);
|
||||
@@ -193,7 +194,6 @@ mrb_str_pool(mrb_state *mrb, mrb_value str)
|
||||
ns->as.ary[len] = '\0';
|
||||
}
|
||||
else {
|
||||
ns->flags = 0;
|
||||
ns->as.heap.ptr = (char *)mrb_malloc(mrb, (size_t)len+1);
|
||||
ns->as.heap.len = len;
|
||||
ns->as.heap.aux.capa = len;
|
||||
|
||||
Reference in New Issue
Block a user