6d3351
From a72554edcb64726b27ea51b4983ec8d9aaec4eaa Mon Sep 17 00:00:00 2001
6d3351
Message-Id: <a72554edcb64726b27ea51b4983ec8d9aaec4eaa@dist-git>
6d3351
From: Jiri Denemark <jdenemar@redhat.com>
6d3351
Date: Tue, 6 Jun 2017 22:27:57 +0200
6d3351
Subject: [PATCH] qemu: Fix memory leaks in qemuDomainSaveImageOpen
6d3351
6d3351
Signed-off-by: Jiri Denemark <jdenemar@redhat.com>
6d3351
Reviewed-by: Pavel Hrdina <phrdina@redhat.com>
6d3351
(cherry picked from commit ac793bd7195ab99445cf6c6d6053439c56cef922)
6d3351
6d3351
https://bugzilla.redhat.com/show_bug.cgi?id=1441662
6d3351
6d3351
Signed-off-by: Jiri Denemark <jdenemar@redhat.com>
6d3351
---
6d3351
 src/qemu/qemu_driver.c | 14 ++++++++------
6d3351
 1 file changed, 8 insertions(+), 6 deletions(-)
6d3351
6d3351
diff --git a/src/qemu/qemu_driver.c b/src/qemu/qemu_driver.c
6d3351
index c8a84503c1..5db92b04a1 100644
6d3351
--- a/src/qemu/qemu_driver.c
6d3351
+++ b/src/qemu/qemu_driver.c
6d3351
@@ -6229,12 +6229,13 @@ qemuDomainSaveImageOpen(virQEMUDriverPtr driver,
6d3351
                 virReportSystemError(errno,
6d3351
                                      _("cannot remove corrupt file: %s"),
6d3351
                                      path);
6d3351
-                goto error;
6d3351
+            } else {
6d3351
+                fd = -3;
6d3351
             }
6d3351
-            return -3;
6d3351
+        } else {
6d3351
+            virReportError(VIR_ERR_OPERATION_FAILED,
6d3351
+                           "%s", _("failed to read qemu header"));
6d3351
         }
6d3351
-        virReportError(VIR_ERR_OPERATION_FAILED,
6d3351
-                       "%s", _("failed to read qemu header"));
6d3351
         goto error;
6d3351
     }
6d3351
 
6d3351
@@ -6249,9 +6250,10 @@ qemuDomainSaveImageOpen(virQEMUDriverPtr driver,
6d3351
                     virReportSystemError(errno,
6d3351
                                          _("cannot remove corrupt file: %s"),
6d3351
                                          path);
6d3351
-                    goto error;
6d3351
+                } else {
6d3351
+                    fd = -3;
6d3351
                 }
6d3351
-                return -3;
6d3351
+                goto error;
6d3351
             }
6d3351
         }
6d3351
         virReportError(VIR_ERR_OPERATION_FAILED, "%s", msg);
6d3351
-- 
6d3351
2.13.1
6d3351