提交 6718132d 编写于 作者: J Ján Tomko

qemuProcessSEVCreateFile: use a cleanup label

A common cleanup path for both the success and the error case.
Signed-off-by: NJán Tomko <jtomko@redhat.com>
Reviewed-by: NBrijesh Singh <brijesh.singh@amd.com>
Tested-by: NBrijesh Singh <brijesh.singh@amd.com>
Reviewed-by: NDaniel P. Berrangé <berrange@redhat.com>
上级 2555749f
......@@ -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;
}
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册