From: Timo Sirainen Date: Tue, 9 Jul 2019 23:09:12 +0000 (+0300) Subject: lib-dns: Log "Disconnect" event before calling DNS callbacks and freeing lookups X-Git-Tag: 2.3.9~390 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=3b7bb089d3cb82f9dbaeeb60f32e2e89620e1850;p=thirdparty%2Fdovecot%2Fcore.git lib-dns: Log "Disconnect" event before calling DNS callbacks and freeing lookups dns_lookup_free() could be freeing the dns_client, which causes a segfault in the e_debug() log call. Broken by fc8c54c48fec6a89d9cda755756c233191c62af1 --- diff --git a/src/lib-dns/dns-lookup.c b/src/lib-dns/dns-lookup.c index fe9144906c..91bbb988d1 100644 --- a/src/lib-dns/dns-lookup.c +++ b/src/lib-dns/dns-lookup.c @@ -99,6 +99,7 @@ static void dns_client_disconnect(struct dns_client *client, const char *error) i_zero(&result); result.ret = EAI_FAIL; result.error = error; + e_debug(client->conn.event, "Disconnect: %s", error); lookup = client->head; client->head = NULL; @@ -108,7 +109,6 @@ static void dns_client_disconnect(struct dns_client *client, const char *error) dns_lookup_free(&lookup); lookup = next; } - e_debug(client->conn.event, "Disconnect: %s", error); } static void dns_client_destroy(struct connection *conn)