diff options
author | Yu Watanabe <watanabe.yu+github@gmail.com> | 2023-12-29 21:35:32 +0100 |
---|---|---|
committer | Yu Watanabe <watanabe.yu+github@gmail.com> | 2023-12-30 20:51:59 +0100 |
commit | 73780aa8a38447671d7c0016d6a73b8d634a1363 (patch) | |
tree | 5e53bd958e06cc1453ec4385449f648a653341c9 /src/resolve/resolved-dns-transaction.c | |
parent | resolve: add several comments for DNS type table (diff) | |
download | systemd-73780aa8a38447671d7c0016d6a73b8d634a1363.tar.xz systemd-73780aa8a38447671d7c0016d6a73b8d634a1363.zip |
resolve: DnsTransaction.scope may be NULL when dns_transaction_close_connection() is called
Follow-up for ac1b7b9e1933c14bc7bf36d4f32a888afb3f2f4d.
Fixes CID#1533020.
Diffstat (limited to 'src/resolve/resolved-dns-transaction.c')
-rw-r--r-- | src/resolve/resolved-dns-transaction.c | 8 |
1 files changed, 6 insertions, 2 deletions
diff --git a/src/resolve/resolved-dns-transaction.c b/src/resolve/resolved-dns-transaction.c index d44315ab1e..e4a1a29071 100644 --- a/src/resolve/resolved-dns-transaction.c +++ b/src/resolve/resolved-dns-transaction.c @@ -74,8 +74,12 @@ static void dns_transaction_close_connection( * and the reply we might still get from the server will be eaten up instead of resulting in an ICMP * port unreachable error message. */ - /* Skip the graveyard stuff when we're shutting down, since that requires running event loop */ - if (!t->scope->manager->event || sd_event_get_state(t->scope->manager->event) == SD_EVENT_FINISHED) + /* Skip the graveyard stuff when we're shutting down, since that requires running event loop. + * Note that this is also called from dns_transaction_free(). In that case, scope may be NULL. */ + if (!t->scope || + !t->scope->manager || + !t->scope->manager->event || + sd_event_get_state(t->scope->manager->event) == SD_EVENT_FINISHED) use_graveyard = false; if (use_graveyard && t->dns_udp_fd >= 0 && t->sent && !t->received) { |