Commit 08603e56 authored by Hans Leidekker's avatar Hans Leidekker Committed by Alexandre Julliard

winhttp: Fix a memory leak in insert_header (Valgrind).

parent c5d733e1
......@@ -368,25 +368,21 @@ static int get_header_index( request_t *request, LPCWSTR field, int requested_in
static BOOL insert_header( request_t *request, header_t *header )
{
DWORD count;
DWORD count = request->num_headers + 1;
header_t *hdrs;
count = request->num_headers + 1;
if (count > 1)
if (request->headers)
hdrs = heap_realloc_zero( request->headers, sizeof(header_t) * count );
else
hdrs = heap_alloc_zero( sizeof(header_t) * count );
if (hdrs)
{
request->headers = hdrs;
request->headers[count - 1].field = strdupW( header->field );
request->headers[count - 1].value = strdupW( header->value );
request->headers[count - 1].is_request = header->is_request;
request->num_headers++;
return TRUE;
}
return FALSE;
hdrs = heap_alloc_zero( sizeof(header_t) );
if (!hdrs) return FALSE;
request->headers = hdrs;
request->headers[count - 1].field = strdupW( header->field );
request->headers[count - 1].value = strdupW( header->value );
request->headers[count - 1].is_request = header->is_request;
request->num_headers = count;
return TRUE;
}
static BOOL delete_header( request_t *request, DWORD index )
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment