diff --git a/dlls/wininet/http.c b/dlls/wininet/http.c
index 2d396086c65..cfbda27b0d9 100644
--- a/dlls/wininet/http.c
+++ b/dlls/wininet/http.c
@@ -1009,6 +1009,9 @@ HINTERNET WINAPI HTTP_HttpOpenRequestW(LPWININETHTTPSESSIONW lpwhs,
     lpwhr->hdr.destroy = HTTP_CloseHTTPRequestHandle;
     lpwhr->hdr.lpfnStatusCB = lpwhs->hdr.lpfnStatusCB;
 
+    WININET_AddRef( &lpwhs->hdr );
+    lpwhr->lpHttpSession = lpwhs;
+
     handle = WININET_AllocHandle( &lpwhr->hdr );
     if (NULL == handle)
     {
@@ -2938,6 +2941,8 @@ static void HTTP_CloseHTTPRequestHandle(LPWININETHANDLEHEADER hdr)
 
     TRACE("\n");
 
+    WININET_Release(&lpwhr->hdr);
+
     if (NETCON_connected(&lpwhr->netConnection))
         HTTP_CloseConnection(lpwhr);
 
diff --git a/dlls/wininet/internet.h b/dlls/wininet/internet.h
index 9c4e7d241ef..de53717fa9c 100644
--- a/dlls/wininet/internet.h
+++ b/dlls/wininet/internet.h
@@ -190,6 +190,7 @@ typedef struct
 typedef struct
 {
     WININETHANDLEHEADER hdr;
+    WININETHTTPSESSIONW *lpHttpSession;
     LPWSTR lpszPath;
     LPWSTR lpszVerb;
     LPWSTR lpszRawHeaders;