From: William Lallemand Date: Mon, 27 Sep 2021 13:17:47 +0000 (+0200) Subject: MINOR: httpclient: destroy() must free the headers and the ists X-Git-Tag: v2.5-dev9~121 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=03f5a1c77dbdd11f35e661eeb80e62dc554ed692;p=thirdparty%2Fhaproxy.git 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. --- diff --git a/src/http_client.c b/src/http_client.c index ab83cdba4c..9e5b2e8311 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;