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

ruby-changes:31626

From: nobu <ko1@a...>
Date: Mon, 18 Nov 2013 22:45:57 +0900 (JST)
Subject: [ruby-changes:31626] nobu:r43705 (trunk): eval_jump.c: refix [Bug #9110]

nobu	2013-11-18 22:45:51 +0900 (Mon, 18 Nov 2013)

  New Revision: 43705

  http://svn.ruby-lang.org/cgi-bin/viewvc.cgi?view=rev&revision=43705

  Log:
    eval_jump.c: refix [Bug #9110]
    
    * eval_jump.c (rb_exec_end_proc): unlink and free procs data before
      calling for each procs.  [Bug #9110]

  Modified files:
    trunk/ChangeLog
    trunk/eval_jump.c
Index: ChangeLog
===================================================================
--- ChangeLog	(revision 43704)
+++ ChangeLog	(revision 43705)
@@ -1,3 +1,8 @@ https://github.com/ruby/ruby/blob/trunk/ChangeLog#L1
+Mon Nov 18 22:45:49 2013  Nobuyoshi Nakada  <nobu@r...>
+
+	* eval_jump.c (rb_exec_end_proc): unlink and free procs data before
+	  calling for each procs.  [Bug #9110]
+
 Sun Nov 17 06:33:32 2013  Shota Fukumori  <her@s...>
 
 	* configure.in: Use $LIBS for base of $SOLIBS, also in darwin.
Index: eval_jump.c
===================================================================
--- eval_jump.c	(revision 43704)
+++ eval_jump.c	(revision 43705)
@@ -96,9 +96,8 @@ rb_mark_end_proc(void) https://github.com/ruby/ruby/blob/trunk/eval_jump.c#L96
 void
 rb_exec_end_proc(void)
 {
-    struct end_proc_data *volatile link;
-    struct end_proc_data *ephemeral_end_procs_head = ephemeral_end_procs;
-    struct end_proc_data *end_procs_head = end_procs;
+    struct end_proc_data volatile endproc;
+    struct end_proc_data volatile *link;
     int status;
     volatile int safe = rb_safe_level();
     rb_thread_t *th = GET_THREAD();
@@ -107,6 +106,9 @@ rb_exec_end_proc(void) https://github.com/ruby/ruby/blob/trunk/eval_jump.c#L106
     while (ephemeral_end_procs) {
 	link = ephemeral_end_procs;
 	ephemeral_end_procs = link->next;
+	endproc = *link;
+	xfree((void *)link);
+	link = &endproc;
 
 	PUSH_TAG();
 	if ((status = EXEC_TAG()) == 0) {
@@ -123,6 +125,9 @@ rb_exec_end_proc(void) https://github.com/ruby/ruby/blob/trunk/eval_jump.c#L125
     while (end_procs) {
 	link = end_procs;
 	end_procs = link->next;
+	endproc = *link;
+	xfree((void *)link);
+	link = &endproc;
 
 	PUSH_TAG();
 	if ((status = EXEC_TAG()) == 0) {
@@ -136,18 +141,6 @@ rb_exec_end_proc(void) https://github.com/ruby/ruby/blob/trunk/eval_jump.c#L141
 	}
     }
 
-    link = ephemeral_end_procs_head;
-    while (link) {
-	xfree(link);
-	link = link->next;
-    }
-
-    link = end_procs_head;
-    while (link) {
-	xfree(link);
-	link = link->next;
-    }
-
     rb_set_safe_level_force(safe);
     th->errinfo = errinfo;
 }

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

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