When stub stream is closed early, then queries associated to the stream
are freed. Previously, the timer event source for queries may not be
disabled, hence may be triggered with already freed query.
See also dns_stub_stream_complete().
Note that we usually not set NULL or zero when freeing simple objects.
But, here DnsQuery is large and complicated object, and the element may
be referenced in subsequent freeing process in the future. Hence, for
safety, let's set NULL to the pointer.
(cherry picked from commit
73bfd7be042cc63e7649242b377ad494bf74ea4b)
(cherry picked from commit
d82bd80cf4e7659906a502735b20a45964b55a88)
if (!q)
return NULL;
+ q->timeout_event_source = sd_event_source_disable_unref(q->timeout_event_source);
+
while (q->auxiliary_queries)
dns_query_free(q->auxiliary_queries);