summaryrefslogtreecommitdiffhomepage
path: root/src/state.c
diff options
context:
space:
mode:
authorYukihiro "Matz" Matsumoto <[email protected]>2014-04-14 16:55:28 +0900
committerYukihiro "Matz" Matsumoto <[email protected]>2014-04-14 16:55:28 +0900
commit4685a43dd69b8303cc0fbff063d6e2812ce7489c (patch)
tree42ff99ec3ca0bf34a93fc17377a5fefddee9e600 /src/state.c
parent10db9e62b64796181cddf6e29e23044477d429ae (diff)
downloadmruby-4685a43dd69b8303cc0fbff063d6e2812ce7489c.tar.gz
mruby-4685a43dd69b8303cc0fbff063d6e2812ce7489c.zip
should always initialize header flags for pooled strings
Diffstat (limited to 'src/state.c')
-rw-r--r--src/state.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/src/state.c b/src/state.c
index 1e26f49cf..618b77cdd 100644
--- a/src/state.c
+++ b/src/state.c
@@ -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;