diff --git a/dlls/wininet/internet.c b/dlls/wininet/internet.c index 72c259eb5b8..4989b5ade4b 100644 --- a/dlls/wininet/internet.c +++ b/dlls/wininet/internet.c @@ -192,7 +192,8 @@ LPWININETHANDLEHEADER WININET_GetObject( HINTERNET hinternet ) EnterCriticalSection( &WININET_cs ); - if( (handle > 0) && ( handle <= WININET_dwMaxHandles ) ) + if( (handle > 0) && ( handle <= WININET_dwMaxHandles ) && + WININET_Handles[handle-1] ) info = WININET_AddRef( WININET_Handles[handle-1] ); LeaveCriticalSection( &WININET_cs ); diff --git a/dlls/wininet/tests/http.c b/dlls/wininet/tests/http.c index 9c968a8b7be..c5a007cc592 100644 --- a/dlls/wininet/tests/http.c +++ b/dlls/wininet/tests/http.c @@ -195,6 +195,8 @@ abort: if (hor != 0x0) { rc = InternetCloseHandle(hor); ok ((rc != 0), "InternetCloseHandle of handle opened by HttpOpenRequestA failed\n"); + rc = InternetCloseHandle(hor); + ok ((rc == 0), "Double close of handle opened by HttpOpenRequestA succeeded\n"); } if (hic != 0x0) { rc = InternetCloseHandle(hic);