summaryrefslogtreecommitdiff
path: root/win32
diff options
context:
space:
mode:
Diffstat (limited to 'win32')
-rw-r--r--win32/win32.c2
1 files changed, 2 insertions, 0 deletions
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