[PATCH] wininet: Release object in HttpEndRequestW after use

Nigel Liang ncliang at gmail.com
Wed Oct 17 19:07:41 CDT 2007


Hi,

This patch fixes the socket not being closed for http requests bug. The open
sockets push the fd of new sockets to higher numbers, and eventually will get
funky behavior. Thanks to Misha for pointing out that this is a reference count
problem.

-Nigel

---
 dlls/wininet/http.c |    3 +++
 1 files changed, 3 insertions(+), 0 deletions(-)

diff --git a/dlls/wininet/http.c b/dlls/wininet/http.c
index 454d332..70239f7 100644
--- a/dlls/wininet/http.c
+++ b/dlls/wininet/http.c
@@ -830,6 +830,8 @@ BOOL WINAPI HttpEndRequestW(HINTERNET hR
     if (NULL == lpwhr || lpwhr->hdr.htype != WH_HHTTPREQ)
     {
         INTERNET_SetLastError(ERROR_INTERNET_INCORRECT_HANDLE_TYPE);
+        if (lpwhr)
+            WININET_Release( &lpwhr->hdr );
     	return FALSE;
     }
 
@@ -881,6 +883,7 @@ BOOL WINAPI HttpEndRequestW(HINTERNET hR
         }
     }
 
+    WININET_Release( &lpwhr->hdr );
     TRACE("%i <--\n",rc);
     return rc;
 }
-- 
1.4.1




More information about the wine-patches mailing list