summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorko1 <ko1@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2017-06-13 02:52:33 +0000
committerko1 <ko1@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2017-06-13 02:52:33 +0000
commiteb0777e86533f999d90f679469174056158d3f30 (patch)
tree4d67abf914ca51ad44d885675992cbf640e7f5f9
parent121550b041b7434e3a3342d317bcbc5760db310d (diff)
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
-rw-r--r--compile.c8
1 files changed, 4 insertions, 4 deletions
diff --git a/compile.c b/compile.c
index 4c755b2..ba4ca76 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;