util: Use g_autofree in virConfLoadConfigPath()

Signed-off-by: Fabiano Fidêncio <fidencio@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
This commit is contained in:
Fabiano Fidêncio 2019-12-19 18:30:33 +01:00
parent d0e1c6a6ae
commit 09ae41b88c

View File

@ -1506,12 +1506,11 @@ virConfLoadConfigPath(const char *name)
if (geteuid() == 0) { if (geteuid() == 0) {
path = g_strdup_printf("%s/libvirt/%s", SYSCONFDIR, name); path = g_strdup_printf("%s/libvirt/%s", SYSCONFDIR, name);
} else { } else {
char *userdir = virGetUserConfigDirectory(); g_autofree char *userdir = virGetUserConfigDirectory();
if (!userdir) if (!userdir)
return NULL; return NULL;
path = g_strdup_printf("%s/%s", userdir, name); path = g_strdup_printf("%s/%s", userdir, name);
VIR_FREE(userdir);
} }
return path; return path;