1
0
mirror of https://github.com/systemd/systemd.git synced 2025-08-24 09:49:49 +03:00

resolve: DnsTransaction.scope may be NULL when dns_transaction_close_connection() is called

Follow-up for ac1b7b9e19.

Fixes CID#1533020.
This commit is contained in:
Yu Watanabe
2023-12-30 05:35:32 +09:00
parent d05649ca7d
commit 73780aa8a3

View File

@ -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) {