diff options
| author | matz <matz@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2009-10-02 08:25:29 +0000 |
|---|---|---|
| committer | matz <matz@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2009-10-02 08:25:29 +0000 |
| commit | 4b986d7ff494df21a59443ea3aa73b873216017f (patch) | |
| tree | 5dae0ed03867bccf444410084fa7ed71e1b6a6d2 | |
| parent | af3460ef8cb371dad29c8c198ed4c0928278194c (diff) | |
* io.c (rb_io_fptr_finalize): free fptr to avoid memory leaks.
fixed: #2009 [ruby-core:25173] [ruby-dev:39410]
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/branches/ruby_1_8@25181 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
| -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 |
