winhttp: Fix a memory leak in insert_header (Valgrind).
Signed-off-by: Hans Leidekker <hans@codeweavers.com> Signed-off-by: Alexandre Julliard <julliard@winehq.org>
This commit is contained in:
parent
c5d733e1ac
commit
08603e565b
|
@ -368,26 +368,22 @@ static int get_header_index( request_t *request, LPCWSTR field, int requested_in
|
||||||
|
|
||||||
static BOOL insert_header( request_t *request, header_t *header )
|
static BOOL insert_header( request_t *request, header_t *header )
|
||||||
{
|
{
|
||||||
DWORD count;
|
DWORD count = request->num_headers + 1;
|
||||||
header_t *hdrs;
|
header_t *hdrs;
|
||||||
|
|
||||||
count = request->num_headers + 1;
|
if (request->headers)
|
||||||
if (count > 1)
|
|
||||||
hdrs = heap_realloc_zero( request->headers, sizeof(header_t) * count );
|
hdrs = heap_realloc_zero( request->headers, sizeof(header_t) * count );
|
||||||
else
|
else
|
||||||
hdrs = heap_alloc_zero( sizeof(header_t) * count );
|
hdrs = heap_alloc_zero( sizeof(header_t) );
|
||||||
|
if (!hdrs) return FALSE;
|
||||||
|
|
||||||
if (hdrs)
|
|
||||||
{
|
|
||||||
request->headers = hdrs;
|
request->headers = hdrs;
|
||||||
request->headers[count - 1].field = strdupW( header->field );
|
request->headers[count - 1].field = strdupW( header->field );
|
||||||
request->headers[count - 1].value = strdupW( header->value );
|
request->headers[count - 1].value = strdupW( header->value );
|
||||||
request->headers[count - 1].is_request = header->is_request;
|
request->headers[count - 1].is_request = header->is_request;
|
||||||
request->num_headers++;
|
request->num_headers = count;
|
||||||
return TRUE;
|
return TRUE;
|
||||||
}
|
}
|
||||||
return FALSE;
|
|
||||||
}
|
|
||||||
|
|
||||||
static BOOL delete_header( request_t *request, DWORD index )
|
static BOOL delete_header( request_t *request, DWORD index )
|
||||||
{
|
{
|
||||||
|
|
Loading…
Reference in New Issue