diff options
author | nobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2010-03-25 05:50:08 +0000 |
---|---|---|
committer | nobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2010-03-25 05:50:08 +0000 |
commit | b3a039a2cb9f8a8f03665cf3d3ed7518c6b512be (patch) | |
tree | 278935bf4fcd415e12f496d02605effb63ded1cf | |
parent | 98131a6da113fa60401edd62db85309acdaa5ad7 (diff) | |
download | ruby-b3a039a2cb9f8a8f03665cf3d3ed7518c6b512be.tar.gz |
* win32/win32.c (rb_w32_{read,write}): fix handle leaks. based on
a patch from Heesob Park in [ruby-core:28919]. [ruby-core:28833]
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@27042 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
-rw-r--r-- | ChangeLog | 5 | ||||
-rw-r--r-- | win32/win32.c | 2 |
2 files changed, 7 insertions, 0 deletions
@@ -1,3 +1,8 @@ +Thu Mar 25 14:50:00 2010 Nobuyoshi Nakada <nobu@ruby-lang.org> + + * win32/win32.c (rb_w32_{read,write}): fix handle leaks. based on + a patch from Heesob Park in [ruby-core:28919]. [ruby-core:28833] + Thu Mar 25 12:37:37 2010 Kazuhiro NISHIYAMA <zn@mbf.nifty.com> * NEWS: add Kernel#singleton_class. diff --git a/win32/win32.c b/win32/win32.c index 58c24d4deb..800f0debe4 100644 --- a/win32/win32.c +++ b/win32/win32.c @@ -4895,6 +4895,7 @@ rb_w32_read(int fd, void *buf, size_t size) if (!ReadFile((HANDLE)_osfhnd(fd), buf, len, &read, pol)) { err = GetLastError(); if (err != ERROR_IO_PENDING) { + if (pol) CloseHandle(ol.hEvent); if (err == ERROR_ACCESS_DENIED) errno = EBADF; else if (err == ERROR_BROKEN_PIPE || err == ERROR_HANDLE_EOF) { @@ -5028,6 +5029,7 @@ rb_w32_write(int fd, const void *buf, size_t size) if (!WriteFile((HANDLE)_osfhnd(fd), buf, len, &written, pol)) { err = GetLastError(); if (err != ERROR_IO_PENDING) { + if (pol) CloseHandle(ol.hEvent); if (err == ERROR_ACCESS_DENIED) errno = EBADF; else |