From 6494c50ad7f613430d3ab1eae7bbebe85bed8925 Mon Sep 17 00:00:00 2001 From: Hans Leidekker Date: Tue, 13 May 2014 13:43:11 +0200 Subject: [PATCH] winhttp: Fix a couple of memory leaks (valgrind). --- dlls/winhttp/net.c | 1 + dlls/winhttp/request.c | 3 ++- 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/dlls/winhttp/net.c b/dlls/winhttp/net.c index 7466d367312..b751bf0ba3f 100644 --- a/dlls/winhttp/net.c +++ b/dlls/winhttp/net.c @@ -488,6 +488,7 @@ BOOL netconn_secure_connect( netconn_t *conn, WCHAR *hostname ) } } + heap_free(read_buf); if(status != SEC_E_OK || res != ERROR_SUCCESS) { WARN("Failed to initialize security context failed: %08x\n", status); diff --git a/dlls/winhttp/request.c b/dlls/winhttp/request.c index 374051a3ac9..54aa6163f7a 100644 --- a/dlls/winhttp/request.c +++ b/dlls/winhttp/request.c @@ -2250,6 +2250,8 @@ static BOOL handle_redirect( request_t *request, DWORD status ) request->read_chunked = FALSE; request->read_chunked_eof = FALSE; } + else heap_free( hostname ); + if (!(ret = add_host_header( request, WINHTTP_ADDREQ_FLAG_REPLACE ))) goto end; if (!(ret = open_connection( request ))) goto end; @@ -2278,7 +2280,6 @@ static BOOL handle_redirect( request_t *request, DWORD status ) ret = TRUE; end: - if (!ret) heap_free( hostname ); heap_free( location ); return ret; }