render / rpms / libvirt

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