A common cleanup path for both the success and the error case. Signed-off-by: Ján Tomko <jtomko@xxxxxxxxxx> --- src/qemu/qemu_process.c | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) diff --git a/src/qemu/qemu_process.c b/src/qemu/qemu_process.c index 5d4b6a9499..7468e14447 100644 --- a/src/qemu/qemu_process.c +++ b/src/qemu/qemu_process.c @@ -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; } -- 2.16.1 -- libvir-list mailing list libvir-list@xxxxxxxxxx https://www.redhat.com/mailman/listinfo/libvir-list