From: Tomas Krizek Date: Tue, 5 Jan 2021 12:08:35 +0000 (+0100) Subject: daemon/http: fix memleak X-Git-Tag: v5.3.0~25^2~2 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=1d68f5ed1f5b0fe89ae8e1bcc7f84205843968d1;p=thirdparty%2Fknot-resolver.git daemon/http: fix memleak The http_data structure is allocated in http_write_pkt() and the last callback that uses it is on_pkt_write(), so it should be responsible for freeing the memory. This used to leak a small amount of memory on every DoH response. --- diff --git a/NEWS b/NEWS index 91e736175..38250d9bb 100644 --- a/NEWS +++ b/NEWS @@ -10,6 +10,7 @@ Improvements Bugfixes -------- - view: fail config if bad subnet is specified (!1112) +- doh2: fix memory leak (!1117) Knot Resolver 5.2.1 (2020-12-09) diff --git a/daemon/http.c b/daemon/http.c index a44ecdd06..944d21a30 100644 --- a/daemon/http.c +++ b/daemon/http.c @@ -417,6 +417,8 @@ static void on_pkt_write(struct http_data *data, int status) return; data->on_write(data->req, status); + + free(data); } /*