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

ruby-changes:13411

From: matz <ko1@a...>
Date: Fri, 2 Oct 2009 17:25:44 +0900 (JST)
Subject: [ruby-changes:13411] Ruby:r25181 (ruby_1_8): * io.c (rb_io_fptr_finalize): free fptr to avoid memory leaks.

matz	2009-10-02 17:25:29 +0900 (Fri, 02 Oct 2009)

  New Revision: 25181

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

  Log:
    * io.c (rb_io_fptr_finalize): free fptr to avoid memory leaks.
      fixed: #2009   [ruby-core:25173] [ruby-dev:39410]

  Modified files:
    branches/ruby_1_8/ChangeLog
    branches/ruby_1_8/io.c

Index: ruby_1_8/ChangeLog
===================================================================
--- ruby_1_8/ChangeLog	(revision 25180)
+++ ruby_1_8/ChangeLog	(revision 25181)
@@ -1,3 +1,8 @@
+Fri Oct  2 17:09:38 2009  Yukihiro Matsumoto  <matz@r...>
+
+	* io.c (rb_io_fptr_finalize): free fptr to avoid memory leaks.
+	  fixed: #2009   [ruby-core:25173] [ruby-dev:39410]
+
 Fri Oct  2 13:54:46 2009  NAKAMURA Usaku  <usa@r...>
 
 	* eval.c (rb_origenviron): remove unused old variable.
Index: ruby_1_8/io.c
===================================================================
--- ruby_1_8/io.c	(revision 25180)
+++ ruby_1_8/io.c	(revision 25181)
@@ -2351,10 +2351,10 @@
     if (fptr->path) {
 	free(fptr->path);
     }
-    if (!fptr->f && !fptr->f2) return;
-    if (fileno(fptr->f) < 3) return;
-
-    rb_io_fptr_cleanup(fptr, Qtrue);
+    if ((fptr->f && fileno(fptr->f) > 2) || fptr->f2) {
+	rb_io_fptr_cleanup(fptr, Qtrue);
+    }
+    xfree(fptr);
 }
 
 VALUE

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

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