mirror of https://gitee.com/openkylin/libvirt.git
qemuProcessSEVCreateFile: use a cleanup label
A common cleanup path for both the success and the error case. Signed-off-by: Ján Tomko <jtomko@redhat.com> Reviewed-by: Brijesh Singh <brijesh.singh@amd.com> Tested-by: Brijesh Singh <brijesh.singh@amd.com> Reviewed-by: Daniel P. Berrangé <berrange@redhat.com>
This commit is contained in:
parent
2555749fd6
commit
6718132d78
|
@ -5831,6 +5831,7 @@ qemuProcessSEVCreateFile(const char *configDir,
|
|||
const char *data)
|
||||
{
|
||||
char *configFile;
|
||||
int ret = -1;
|
||||
|
||||
if (!(configFile = virFileBuildPath(configDir, name, ".base64")))
|
||||
return -1;
|
||||
|
@ -5838,15 +5839,12 @@ qemuProcessSEVCreateFile(const char *configDir,
|
|||
if (virFileRewriteStr(configFile, S_IRUSR | S_IWUSR, data) < 0) {
|
||||
virReportSystemError(errno, _("failed to write data to config '%s'"),
|
||||
configFile);
|
||||
goto error;
|
||||
goto cleanup;
|
||||
}
|
||||
|
||||
cleanup:
|
||||
VIR_FREE(configFile);
|
||||
return 0;
|
||||
|
||||
error:
|
||||
VIR_FREE(configFile);
|
||||
return -1;
|
||||
return ret;
|
||||
}
|
||||
|
||||
|
||||
|
|
Loading…
Reference in New Issue