]> git.ipfire.org Git - thirdparty/libvirt.git/commit
virsysinfo: Define and use auto cleanup func for virSysinfoDef properly
authorMichal Privoznik <mprivozn@redhat.com>
Thu, 11 Mar 2021 05:17:07 +0000 (06:17 +0100)
committerMichal Privoznik <mprivozn@redhat.com>
Mon, 15 Mar 2021 08:34:18 +0000 (09:34 +0100)
commitab9afee6e729e98d2ffef6a8c50ffc143b08248b
tree39f56db0ef77d2ea1b2e805afc7474ebf8930f86
parent52a937d8a2328c83018f0a69393b2840788c2d25
virsysinfo: Define and use auto cleanup func for virSysinfoDef properly

What we are using really is heap allocated structure rather than
stack allocated. And for that it's better to use g_autoptr() +
G_DEFINE_AUTOPTR_CLEANUP_FUNC() combo, as Glib documentation for
g_auto() reads:

  This is meant to be used with stack-allocated structures and
  non-pointer types. For the (more commonly used) pointer
  version, see g_autoptr().

This will be even more visible, when virSysinfoDefPtr type is
gone. Stay tuned.

Fixes: cee3a900a0d6a8fc79554db22dc262632fe487a6
Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
src/util/virsysinfo.c
src/util/virsysinfo.h
tests/sysinfotest.c