wininet: Dangling pointer fix

Andrew Talbot andrew.talbot at talbotville.com
Thu Jun 19 16:25:40 CDT 2008


Changelog:
    wininet: Dangling pointer fix.

diff --git a/dlls/wininet/internet.c b/dlls/wininet/internet.c
index 1ae8cce..a460ebe 100644
--- a/dlls/wininet/internet.c
+++ b/dlls/wininet/internet.c
@@ -586,7 +586,6 @@ HINTERNET WINAPI InternetOpenW(LPCWSTR lpszAgent, DWORD dwAccessType,
     handle = WININET_AllocHandle( &lpwai->hdr );
     if( !handle )
     {
-        HeapFree( GetProcessHeap(), 0, lpwai );
         INTERNET_SetLastError(ERROR_OUTOFMEMORY);
 	goto lend;
     }
@@ -617,10 +616,13 @@ HINTERNET WINAPI InternetOpenW(LPCWSTR lpszAgent, DWORD dwAccessType,
     }
 
 lend:
+    TRACE("returning %p\n", lpwai);
+
     if( lpwai )
+    {
         WININET_Release( &lpwai->hdr );
-
-    TRACE("returning %p\n", lpwai);
+        HeapFree( GetProcessHeap(), 0, lpwai );
+    }
 
     return handle;
 }



More information about the wine-patches mailing list