Hans Leidekker : winhttp: Clean up properly in request_send.

Alexandre Julliard julliard at winehq.org
Wed Nov 16 12:46:45 CST 2011


Module: wine
Branch: master
Commit: 2621e98d04b91ce21d36ac880ace323bd3c6360f
URL:    http://source.winehq.org/git/wine.git/?a=commit;h=2621e98d04b91ce21d36ac880ace323bd3c6360f

Author: Hans Leidekker <hans at codeweavers.com>
Date:   Wed Nov 16 09:41:47 2011 +0100

winhttp: Clean up properly in request_send.

---

 dlls/winhttp/request.c |   14 +++++++++-----
 1 files changed, 9 insertions(+), 5 deletions(-)

diff --git a/dlls/winhttp/request.c b/dlls/winhttp/request.c
index e86cdf1..257fc97 100644
--- a/dlls/winhttp/request.c
+++ b/dlls/winhttp/request.c
@@ -2925,14 +2925,18 @@ static HRESULT request_send( struct winhttp_request *request )
     if (!(ret = WinHttpSendRequest( request->hrequest, NULL, 0, ptr, size, size, 0 )))
     {
         err = get_last_error();
+        goto error;
     }
-    if (!sa) heap_free( ptr );
-    else if ((hr = SafeArrayUnaccessData( sa )) != S_OK) return hr;
-    if (!ret) return HRESULT_FROM_WIN32( err );
-    if ((err = wait_for_completion( request ))) return HRESULT_FROM_WIN32( err );
-
+    if ((err = wait_for_completion( request ))) goto error;
+    if (sa) SafeArrayUnaccessData( sa );
+    else heap_free( ptr );
     request->state = REQUEST_STATE_SENT;
     return S_OK;
+
+error:
+    if (sa) SafeArrayUnaccessData( sa );
+    else heap_free( ptr );
+    return HRESULT_FROM_WIN32( err );
 }
 
 static HRESULT request_send_and_receive( struct winhttp_request *request )




More information about the wine-cvs mailing list