libfreerdp/utils/http.c: fix resource leak
found by coverity 128 if (winpr_asprintf(&headers, &size, post_header_fmt, path, hostname, blen) < 0) CID 424888: (#1 of 1): Resource leak (RESOURCE_LEAK) 15. leaked_storage: Variable hostname going out of scope leaks the storage it points to. 129 return FALSE; 130 }
This commit is contained in:
parent
822537be0e
commit
1f3a49c57a
@ -126,12 +126,18 @@ BOOL freerdp_http_request(const char* url, const char* body, long* status_code,
|
||||
{
|
||||
blen = strlen(body);
|
||||
if (winpr_asprintf(&headers, &size, post_header_fmt, path, hostname, blen) < 0)
|
||||
{
|
||||
free(hostname);
|
||||
return FALSE;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
if (winpr_asprintf(&headers, &size, get_header_fmt, path, hostname) < 0)
|
||||
{
|
||||
free(hostname);
|
||||
return FALSE;
|
||||
}
|
||||
}
|
||||
|
||||
ssl_ctx = SSL_CTX_new(TLS_client_method());
|
||||
|
Loading…
Reference in New Issue
Block a user