diff options
| -rw-r--r-- | ChangeLog | 5 | ||||
| -rw-r--r-- | io.c | 8 |
2 files changed, 9 insertions, 4 deletions
@@ -1,3 +1,8 @@ +Fri Oct 2 17:09:38 2009 Yukihiro Matsumoto <matz@ruby-lang.org> + + * 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@ruby-lang.org> * eval.c (rb_origenviron): remove unused old variable. @@ -2351,10 +2351,10 @@ rb_io_fptr_finalize(fptr) 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 |
