[前][次][番号順一覧][スレッド一覧]

ruby-changes:46959

From: ko1 <ko1@a...>
Date: Tue, 13 Jun 2017 11:52:39 +0900 (JST)
Subject: [ruby-changes:46959] ko1:r59074 (trunk): fix to free unallocated memory.

ko1	2017-06-13 11:52:33 +0900 (Tue, 13 Jun 2017)

  New Revision: 59074

  https://svn.ruby-lang.org/cgi-bin/viewvc.cgi?view=revision&revision=59074

  Log:
    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.

  Modified files:
    trunk/compile.c
Index: compile.c
===================================================================
--- compile.c	(revision 59073)
+++ compile.c	(revision 59074)
@@ -1564,8 +1564,8 @@ get_ivar_ic_value(rb_iseq_t *iseq,ID id) https://github.com/ruby/ruby/blob/trunk/compile.c#L1564
 }
 
 #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) https://github.com/ruby/ruby/blob/trunk/compile.c#L1575
 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;
 

--
ML: ruby-changes@q...
Info: http://www.atdot.net/~ko1/quickml/

[前][次][番号順一覧][スレッド一覧]