]> git.ipfire.org Git - thirdparty/dovecot/core.git/commitdiff
lib-dns: Log "Disconnect" event before calling DNS callbacks and freeing lookups
authorTimo Sirainen <timo.sirainen@open-xchange.com>
Tue, 9 Jul 2019 23:09:12 +0000 (02:09 +0300)
committerTimo Sirainen <timo.sirainen@open-xchange.com>
Wed, 10 Jul 2019 06:43:56 +0000 (09:43 +0300)
dns_lookup_free() could be freeing the dns_client, which causes a segfault
in the e_debug() log call.

Broken by fc8c54c48fec6a89d9cda755756c233191c62af1

src/lib-dns/dns-lookup.c

index fe9144906cb7d0b6e7b01f5da92eaf75153ff652..91bbb988d1ffc4638a08bc2b4865134b8b49e194 100644 (file)
@@ -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)