mirror of
https://github.com/systemd/systemd.git
synced 2026-08-03 14:40:31 +00:00
resolve: on_transaction_stream_error() may free multiple transactions
Fixes #30928.
This commit is contained in:
committed by
Luca Boccassi
parent
af8d919dcb
commit
3db1e6a874
@@ -638,9 +638,20 @@ static int on_stream_complete(DnsStream *s, int error) {
|
||||
}
|
||||
}
|
||||
|
||||
if (error != 0)
|
||||
LIST_FOREACH(transactions_by_stream, t, s->transactions)
|
||||
if (error != 0) {
|
||||
/* First, detach the stream from the server. Otherwise, transactions attached to this stream
|
||||
* may be restarted by on_transaction_stream_error() below with this stream. */
|
||||
dns_stream_detach(s);
|
||||
|
||||
/* Do not use LIST_FOREACH() here, as
|
||||
* on_transaction_stream_error()
|
||||
* -> dns_transaction_complete_errno()
|
||||
* -> dns_transaction_free()
|
||||
* may free multiple transactions in the list. */
|
||||
DnsTransaction *t;
|
||||
while ((t = s->transactions))
|
||||
on_transaction_stream_error(t, error);
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user