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;