]> git.ipfire.org Git - thirdparty/haproxy.git/commitdiff
MINOR: httpclient: destroy() must free the headers and the ists
authorWilliam Lallemand <wlallemand@haproxy.org>
Mon, 27 Sep 2021 13:17:47 +0000 (15:17 +0200)
committerWilliam Lallemand <wlallemand@haproxy.org>
Wed, 6 Oct 2021 13:15:03 +0000 (15:15 +0200)
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

index ab83cdba4cb2eecaea9f65084be448d33422803c..9e5b2e8311de53f83ebb59089ec13c61d56105ed 100644 (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;