]> git.ipfire.org Git - thirdparty/libvirt.git/commit
remote: use g_auto for client RPC return parameters
authorDaniel P. Berrangé <berrange@redhat.com>
Thu, 22 Dec 2022 16:09:27 +0000 (11:09 -0500)
committerDaniel P. Berrangé <berrange@redhat.com>
Fri, 3 Nov 2023 18:06:35 +0000 (14:06 -0400)
commit501825011c1fe80f458820c7efe5a198e0af9be5
treed6b167d84bc0ba21a38a7b35184af911c023a4b9
parent154495a0c0d198e8e62e688eb9e1d9f9c9d7d897
remote: use g_auto for client RPC return parameters

Currently some, but not all, methods have a call to the
xdr_free function, for the 'ret' variable. This is done
on methods where there are complex structs containing
allocated memory. In other cases the structs contain
allocated memory, but the pointer is stolen, so xdr_free
is not called. In other cases no allocated memory is
present, so xdr_free.

This is hard to reason about, because the definition of
the struct is not visible in the client stubs.

Switch to use g_auto() for the 'ret' variable, which
means 'xdr_free' is always going to be called. Some
places now need to use g_steal_pointer as a result.

Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
Signed-off-by: Daniel P. Berrangé <berrange@redhat.com>
src/remote/remote_driver.c