From eb0777e86533f999d90f679469174056158d3f30 Mon Sep 17 00:00:00 2001 From: ko1 Date: Tue, 13 Jun 2017 02:52:33 +0000 Subject: fix to free unallocated memory. * compile.c (iseq_set_sequence): initialize with NULL for line_info_table and generated_iseq and check NULL at BADINSN_ERROR. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@59074 b2dd03c8-39d4-4d8f-98ff-823fe69b080e --- compile.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/compile.c b/compile.c index 4c755b2389..ba4ca76520 100644 --- a/compile.c +++ b/compile.c @@ -1564,8 +1564,8 @@ get_ivar_ic_value(rb_iseq_t *iseq,ID id) } #define BADINSN_ERROR \ - (xfree(generated_iseq), \ - xfree(line_info_table), \ + (generated_iseq ? xfree(generated_iseq) : 0, \ + line_info_table ? xfree(line_info_table) : 0, \ dump_disasm_list_with_cursor(&anchor->anchor, list), \ COMPILE_ERROR) @@ -1575,10 +1575,10 @@ get_ivar_ic_value(rb_iseq_t *iseq,ID id) static int iseq_set_sequence(rb_iseq_t *iseq, LINK_ANCHOR *const anchor) { - struct iseq_line_info_entry *line_info_table; + struct iseq_line_info_entry *line_info_table = NULL; unsigned int last_line = 0; LINK_ELEMENT *list; - VALUE *generated_iseq; + VALUE *generated_iseq = NULL; int insn_num, code_index, line_info_index, sp, stack_max = 0, line = 0; -- cgit v1.2.3