virLockDaemonPostExecRestart: Automatically free temporary variables

Convert two temp strings and one virJSONValue to g_auto(free|ptr).

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
This commit is contained in:
Peter Krempa 2021-12-01 09:23:19 +01:00
parent f24bc212ab
commit bec4f09fff

View File

@ -607,10 +607,10 @@ virLockDaemonPostExecRestart(const char *state_file,
bool privileged)
{
const char *gotmagic;
char *wantmagic = NULL;
g_autofree char *wantmagic = NULL;
int ret = -1;
char *state = NULL;
virJSONValue *object = NULL;
g_autofree char *state = NULL;
g_autoptr(virJSONValue) object = NULL;
VIR_DEBUG("Running post-restart exec");
@ -660,9 +660,6 @@ virLockDaemonPostExecRestart(const char *state_file,
cleanup:
unlink(state_file);
VIR_FREE(wantmagic);
VIR_FREE(state);
virJSONValueFree(object);
return ret;
}