PATCH: descriptor leakage in comm

Marcus Meissner meissner at suse.de
Tue Mar 11 05:37:13 CST 2003


Hi,

The 2 close(fd) are straight forward.

The GetLastError() removal is a bit unclear, but GLE at least
will never return STATUS_PENDING, so it is wrong in some way.

It fixes a 16bit PBX configuration program problem.

Ciao, Marcus

Changelog:
	Fixed 2 fd leaks in comm functions.
	Removed erroneous GetLastError() check in WaitCommEvent().

Index: dlls/kernel/comm.c
===================================================================
RCS file: /home/wine/wine/dlls/kernel/comm.c,v
retrieving revision 1.68
diff -u -r1.68 comm.c
--- dlls/kernel/comm.c	25 Oct 2002 21:02:30 -0000	1.68
+++ dlls/kernel/comm.c	11 Mar 2003 10:55:02 -0000
@@ -1567,6 +1567,7 @@
 
     if (-1==tcgetattr(fd,&tios)) {
         FIXME("tcgetattr on fd %d failed!\n",fd);
+        close(fd);
         return FALSE;
     }
 
@@ -1591,6 +1592,7 @@
 
     if (-1==tcsetattr(fd,0,&tios)) {
         FIXME("tcsetattr on fd %d failed!\n",fd);
+        close(fd);
         return FALSE;
     }
     close(fd);
@@ -1759,12 +1761,6 @@
     ov.hEvent = CreateEventA(NULL,FALSE,FALSE,NULL);
 
     COMM_WaitCommEvent(hFile, lpdwEvents, &ov);
-
-    if(GetLastError()!=STATUS_PENDING)
-    {
-        CloseHandle(ov.hEvent);
-        return FALSE;
-    }
 
     /* wait for the overlapped to complete */
     ret = GetOverlappedResult(hFile, &ov, NULL, TRUE);



More information about the wine-patches mailing list