MINOR: httpclient: destroy() must free the headers and the ists

httpclient_destroy() must free all the ist in the httpclient structure,
the URL in the request, the vsn and reason in the response.

It also must free the list of headers of the response.
This commit is contained in:
William Lallemand 2021-09-27 15:17:47 +02:00
parent d34758849e
commit 03f5a1c77d

View File

@ -410,10 +410,27 @@ out:
/* Free the httpclient */
void httpclient_destroy(struct httpclient *hc)
{
struct http_hdr *hdrs;
if (!hc)
return;
/* request */
istfree(&hc->req.url);
b_free(&hc->req.buf);
/* response */
istfree(&hc->res.vsn);
istfree(&hc->res.reason);
hdrs = hc->res.hdrs;
while (hdrs && isttest(hdrs->n)) {
istfree(&hdrs->n);
istfree(&hdrs->v);
hdrs++;
}
ha_free(&hc->res.hdrs);
b_free(&hc->res.buf);
free(hc);
return;