logging: Use g_autofree in virLogDaemonConfigFilePath()

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 09:41:11 +01:00
parent 70c2052011
commit ce33c21f23

View File

@ -42,13 +42,12 @@ virLogDaemonConfigFilePath(bool privileged, char **configfile)
if (privileged) { if (privileged) {
*configfile = g_strdup(SYSCONFDIR "/libvirt/virtlogd.conf"); *configfile = g_strdup(SYSCONFDIR "/libvirt/virtlogd.conf");
} else { } else {
char *configdir = NULL; g_autofree char *configdir = NULL;
if (!(configdir = virGetUserConfigDirectory())) if (!(configdir = virGetUserConfigDirectory()))
goto error; goto error;
*configfile = g_strdup_printf("%s/virtlogd.conf", configdir); *configfile = g_strdup_printf("%s/virtlogd.conf", configdir);
VIR_FREE(configdir);
} }
return 0; return 0;