winhttp: Properly free all allocated memory on error in WinHttpOpen (try 2)

Bruno Jesus 00cpxxx at gmail.com
Tue Jun 17 17:53:00 CDT 2014


try 2:
Simplify the patch by not touching the current duplicated code.
Session_destroy source for reference:
http://source.winehq.org/source/dlls/winhttp/session.c#L90

original:
Found while checking bug https://bugs.winehq.org/show_bug.cgi?id=36600
-------------- next part --------------
diff --git a/dlls/winhttp/session.c b/dlls/winhttp/session.c
index 56e776d..8da9e35 100644
--- a/dlls/winhttp/session.c
+++ b/dlls/winhttp/session.c
@@ -264,10 +264,13 @@ HINTERNET WINAPI WinHttpOpen( LPCWSTR agent, DWORD access, LPCWSTR proxy, LPCWST
     if (!(handle = alloc_handle( &session->hdr ))) goto end;
     session->hdr.handle = handle;
 
-end:
     release_object( &session->hdr );
     TRACE("returning %p\n", handle);
     return handle;
+end:
+    session_destroy( &session->hdr );
+    TRACE("returning (null)\n");
+    return NULL;
 }
 
 /***********************************************************************


More information about the wine-patches mailing list