summaryrefslogtreecommitdiff
path: root/io.c
diff options
context:
space:
mode:
authorshyouhei <shyouhei@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2009-11-19 06:51:19 +0000
committershyouhei <shyouhei@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2009-11-19 06:51:19 +0000
commit2dae3d23d20a4d94b17ad4c479fcd12dba22ac7d (patch)
treeed38aeadf8d65565839d0180addcfeab29e38ec4 /io.c
parent6cef092f68e7c1f147c64c4462b025f3ffddeed5 (diff)
merge revision(s) 25181:
* 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_7@25852 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'io.c')
-rw-r--r--io.c8
1 files changed, 4 insertions, 4 deletions
diff --git a/io.c b/io.c
index b295d102ad..1bdb5ec2c9 100644
--- a/io.c
+++ b/io.c
@@ -2334,10 +2334,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