From 21366b17a5009d13b9f0ebf78e5a248494835847 Mon Sep 17 00:00:00 2001 From: ko1 Date: Mon, 7 Dec 2015 18:44:45 +0000 Subject: * compile.c (rb_iseq_build_from_ary): do not allocate table if table_size is 0. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@52923 b2dd03c8-39d4-4d8f-98ff-823fe69b080e --- compile.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'compile.c') 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++) { -- cgit v1.2.3