summaryrefslogtreecommitdiffhomepage
path: root/src/state.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/state.c')
-rw-r--r--src/state.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/src/state.c b/src/state.c
index 7b5bd1002..92cce33a1 100644
--- a/src/state.c
+++ b/src/state.c
@@ -45,7 +45,7 @@ allocf(mrb_state *mrb, void *p, size_t size, void *ud)
struct alloca_header {
struct alloca_header *next;
- char buf[0];
+ char buf[1];
};
void*
@@ -53,7 +53,7 @@ mrb_alloca(mrb_state *mrb, size_t size)
{
struct alloca_header *p;
- p = (struct alloca_header*) mrb_malloc(mrb, sizeof(struct alloca_header)+size);
+ p = (struct alloca_header*) mrb_malloc(mrb, sizeof(struct alloca_header)+size-1);
if (p == NULL) return NULL;
p->next = mrb->mems;
mrb->mems = p;