]> git.ipfire.org Git - thirdparty/systemd.git/commit
dns-packet: move p->more unref into the free path
authorOblivionsage <cookieandcream560@gmail.com>
Sat, 21 Mar 2026 16:43:50 +0000 (17:43 +0100)
committerDaan De Meyer <daan.j.demeyer@gmail.com>
Sat, 21 Mar 2026 19:34:39 +0000 (20:34 +0100)
commit494c65236b19e160ade48315edfa0f089f3d4154
treee0e38e74d463c99294d2d22d3cdea46689d31b12
parent7c1075fb8ff2d3b87fa463d542e2e00ac086cbd3
dns-packet: move p->more unref into the free path

dns_packet_unref() unconditionally unrefs p->more on every call,
even when n_ref > 1. But dns_packet_ref() doesn't ref p->more.
This means if a packet with a ->more chain gets ref'd and unref'd
multiple times, the chain gets freed too early while the parent
still holds a dangling pointer.

Move the p->more unref into the n_ref == 1 block so the chain
only gets cleaned up when the packet is actually being freed.
src/shared/dns-packet.c