Skip to content

Commit

Permalink
libfreerdp/utils/http.c: fix resource leak
Browse files Browse the repository at this point in the history
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        }
  • Loading branch information
chipitsine authored and akallabeth committed Apr 8, 2024
1 parent 822537b commit 1f3a49c
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions libfreerdp/utils/http.c
Original file line number Diff line number Diff line change
Expand Up @@ -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());
Expand Down

0 comments on commit 1f3a49c

Please sign in to comment.