]> git.ipfire.org Git - thirdparty/systemd.git/commit
resolvectl: fix JSON reply cleanup in varlink_dump_dns_configuration 42812/head
authordongshengyuan <545258830@qq.com>
Tue, 30 Jun 2026 09:13:10 +0000 (17:13 +0800)
committerdongshengyuan <545258830@qq.com>
Tue, 30 Jun 2026 09:26:41 +0000 (17:26 +0800)
commit7808a0c5419e9071bb5a6e688162c9bd968a8075
tree71fa28b36191eeff1f9eeb7a454586370694f2b2
parent04ab634776c0fdc47d7c40c03a2865436759746e
resolvectl: fix JSON reply cleanup in varlink_dump_dns_configuration

varlink_call_and_log() does not hand out a new reference for the reply
object, so the caller should not unref it. The _cleanup_(sd_json_variant_unrefp)
on reply was therefore wrong from the start.

The original TAKE_PTR(reply) was working around this incorrect cleanup
by preventing it from firing, but that left reply's refcount one too
high after sd_json_variant_ref(v) incremented the parent's count.

Fix by dropping _cleanup_(sd_json_variant_unrefp) from the reply
variable declaration entirely, as suggested by Lennart Poettering.

Signed-off-by: dongshengyuan <dongshengyuan@uniontech.com>
src/resolve/resolvectl.c