[PATCH] wininet: Fix potential use-after-free (Coverity)

Nikolay Sivov nsivov at codeweavers.com
Sun Jul 9 09:00:39 CDT 2017


Signed-off-by: Nikolay Sivov <nsivov at codeweavers.com>
---
 dlls/wininet/http.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/dlls/wininet/http.c b/dlls/wininet/http.c
index ef9f144797..078a5cb95c 100644
--- a/dlls/wininet/http.c
+++ b/dlls/wininet/http.c
@@ -4133,12 +4133,12 @@ static DWORD HTTP_HandleRedirect(http_request_t *request, WCHAR *url)
         request->path = heap_alloc(needed*sizeof(WCHAR));
         rc = UrlEscapeW(path, request->path, &needed,
                         URL_ESCAPE_SPACES_ONLY);
-        heap_free(path);
         if (rc != S_OK)
         {
             ERR("Unable to escape string!(%s) (%d)\n",debugstr_w(path),rc);
             strcpyW(request->path, path);
         }
+        heap_free(path);
     }
 
     /* Remove custom content-type/length headers on redirects.  */
-- 
2.13.2




More information about the wine-patches mailing list