From 03f5a1c77dbdd11f35e661eeb80e62dc554ed692 Mon Sep 17 00:00:00 2001 From: William Lallemand Date: Mon, 27 Sep 2021 15:17:47 +0200 Subject: [PATCH] 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. --- src/http_client.c | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/src/http_client.c b/src/http_client.c index ab83cdba4..9e5b2e831 100644 --- a/src/http_client.c +++ b/src/http_client.c @@ -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;