]> git.ipfire.org Git - thirdparty/knot-resolver.git/commitdiff
daemon/http: fix memleak
authorTomas Krizek <tomas.krizek@nic.cz>
Tue, 5 Jan 2021 12:08:35 +0000 (13:08 +0100)
committerTomas Krizek <tomas.krizek@nic.cz>
Thu, 7 Jan 2021 12:49:44 +0000 (13:49 +0100)
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.

NEWS
daemon/http.c

diff --git a/NEWS b/NEWS
index 91e736175ddeb3cb9b470d307e28d6f5e3718ff9..38250d9bb3ecb32d58b0957cd3daccbaf1c5da04 100644 (file)
--- 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)
index a44ecdd069f24ac0cc7b652c3c6565d88271e211..944d21a3049020bdad793ad00202bbe04f5d029e 100644 (file)
@@ -417,6 +417,8 @@ static void on_pkt_write(struct http_data *data, int status)
                return;
 
        data->on_write(data->req, status);
+
+       free(data);
 }
 
 /*