diff options
author | ko1 <ko1@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2015-12-07 18:44:45 +0000 |
---|---|---|
committer | ko1 <ko1@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2015-12-07 18:44:45 +0000 |
commit | 8b2c68018fd5b6bfa7bbd2444f7b5e7a5ea6c3f5 (patch) | |
tree | ae303aba3a1fcf374b3e9829232f872332cccb2c | |
parent | b72580ecd02fffdc05afa8bc071927c6cebf34d9 (diff) | |
download | ruby-8b2c68018fd5b6bfa7bbd2444f7b5e7a5ea6c3f5.tar.gz |
* 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
-rw-r--r-- | ChangeLog | 5 | ||||
-rw-r--r-- | compile.c | 2 |
2 files changed, 6 insertions, 1 deletions
@@ -1,3 +1,8 @@ +Tue Dec 8 03:43:21 2015 Koichi Sasada <ko1@atdot.net> + + * 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 <e@80x24.org> * ext/socket/unixsocket.c (unix_send_io): document args @@ -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++) { |