提交 5de4d410 编写于 作者: J Ján Tomko

virQEMUDriverConfigLoadSWTPMEntry: use VIR_AUTOFREE

Switch the function to use VIR_AUTOFREE and VIR_AUTOPTR macros
to get rid of the cleanup section.
Requested-by: NJohn Ferlan <jferlan@redhat.com>
Signed-off-by: NJán Tomko <jtomko@redhat.com>
Reviewed-by: NErik Skultety <eskultet@redhat.com>
上级 784e690e
......@@ -984,24 +984,20 @@ static int
virQEMUDriverConfigLoadSWTPMEntry(virQEMUDriverConfigPtr cfg,
virConfPtr conf)
{
char *swtpm_user = NULL, *swtpm_group = NULL;
int ret = -1;
VIR_AUTOFREE(char *) swtpm_user = NULL;
VIR_AUTOFREE(char *) swtpm_group = NULL;
if (virConfGetValueString(conf, "swtpm_user", &swtpm_user) < 0)
goto cleanup;
return -1;
if (swtpm_user && virGetUserID(swtpm_user, &cfg->swtpm_user) < 0)
goto cleanup;
return -1;
if (virConfGetValueString(conf, "swtpm_group", &swtpm_group) < 0)
goto cleanup;
return -1;
if (swtpm_group && virGetGroupID(swtpm_group, &cfg->swtpm_group) < 0)
goto cleanup;
return -1;
ret = 0;
cleanup:
VIR_FREE(swtpm_user);
VIR_FREE(swtpm_group);
return ret;
return 0;
}
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册