mirror of
https://gitlab.com/libvirt/libvirt.git
synced 2024-12-23 22:25:25 +00:00
virQEMUDriverConfigLoadSWTPMEntry: use VIR_AUTOFREE
Switch the function to use VIR_AUTOFREE and VIR_AUTOPTR macros to get rid of the cleanup section. Requested-by: John Ferlan <jferlan@redhat.com> Signed-off-by: Ján Tomko <jtomko@redhat.com> Reviewed-by: Erik Skultety <eskultet@redhat.com>
This commit is contained in:
parent
784e690ecb
commit
5de4d410a2
@ -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;
|
||||
}
|
||||
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user