diff --git a/ChangeLog b/ChangeLog index b781975baa..0ede8ca47d 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,8 @@ +Tue Dec 8 03:43:21 2015 Koichi Sasada + + * compile.c (rb_iseq_build_from_ary): do not allocate table + if table_size is 0. + Tue Dec 8 03:30:34 2015 Eric Wong * ext/socket/unixsocket.c (unix_send_io): document args diff --git a/compile.c b/compile.c index c9b44ec2e9..9be8fd57c8 100644 --- a/compile.c +++ b/compile.c @@ -6545,7 +6545,7 @@ rb_iseq_build_from_ary(rb_iseq_t *iseq, VALUE misc, VALUE locals, VALUE params, len = RARRAY_LENINT(locals); iseq->body->local_table_size = len; - iseq->body->local_table = tbl = (ID *)ALLOC_N(ID, iseq->body->local_table_size); + iseq->body->local_table = tbl = len > 0 ? (ID *)ALLOC_N(ID, iseq->body->local_table_size) : NULL; iseq->body->local_size = iseq->body->local_table_size + 1; for (i = 0; i < len; i++) {