mirror of
https://github.com/libvirt/libvirt.git
synced 2025-02-25 18:55:26 -06:00
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: cee3a900a0
Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
This commit is contained in:
@@ -91,7 +91,7 @@ testSysinfo(const void *data)
|
||||
{
|
||||
const struct testSysinfoData *testdata = data;
|
||||
const char *sysfsActualData;
|
||||
g_auto(virSysinfoDefPtr) ret = NULL;
|
||||
g_autoptr(virSysinfoDef) ret = NULL;
|
||||
g_auto(virBuffer) buf = VIR_BUFFER_INITIALIZER;
|
||||
g_autofree char *sysinfo = NULL;
|
||||
g_autofree char *cpuinfo = NULL;
|
||||
|
||||
Reference in New Issue
Block a user