mirror of
https://gitlab.com/libvirt/libvirt.git
synced 2025-03-07 17:28:15 +00:00
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)
|
const char *data)
|
||||||
{
|
{
|
||||||
char *configFile;
|
char *configFile;
|
||||||
|
int ret = -1;
|
||||||
|
|
||||||
if (!(configFile = virFileBuildPath(configDir, name, ".base64")))
|
if (!(configFile = virFileBuildPath(configDir, name, ".base64")))
|
||||||
return -1;
|
return -1;
|
||||||
@ -5838,15 +5839,12 @@ qemuProcessSEVCreateFile(const char *configDir,
|
|||||||
if (virFileRewriteStr(configFile, S_IRUSR | S_IWUSR, data) < 0) {
|
if (virFileRewriteStr(configFile, S_IRUSR | S_IWUSR, data) < 0) {
|
||||||
virReportSystemError(errno, _("failed to write data to config '%s'"),
|
virReportSystemError(errno, _("failed to write data to config '%s'"),
|
||||||
configFile);
|
configFile);
|
||||||
goto error;
|
goto cleanup;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
cleanup:
|
||||||
VIR_FREE(configFile);
|
VIR_FREE(configFile);
|
||||||
return 0;
|
return ret;
|
||||||
|
|
||||||
error:
|
|
||||||
VIR_FREE(configFile);
|
|
||||||
return -1;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user