]> git.ipfire.org Git - thirdparty/libvirt.git/commitdiff
qemu: Fix memory leaks in qemuDomainSaveImageOpen
authorJiri Denemark <jdenemar@redhat.com>
Tue, 6 Jun 2017 20:27:57 +0000 (22:27 +0200)
committerJiri Denemark <jdenemar@redhat.com>
Wed, 7 Jun 2017 11:36:01 +0000 (13:36 +0200)
Signed-off-by: Jiri Denemark <jdenemar@redhat.com>
Reviewed-by: Pavel Hrdina <phrdina@redhat.com>
src/qemu/qemu_driver.c

index 2b5636c9fd6c14141c5e693fd3aec562d36c6fee..115947ec21abfc33329624155d1fe0b46a47369a 100644 (file)
@@ -6235,12 +6235,13 @@ qemuDomainSaveImageOpen(virQEMUDriverPtr driver,
                 virReportSystemError(errno,
                                      _("cannot remove corrupt file: %s"),
                                      path);
-                goto error;
+            } else {
+                fd = -3;
             }
-            return -3;
+        } else {
+            virReportError(VIR_ERR_OPERATION_FAILED,
+                           "%s", _("failed to read qemu header"));
         }
-        virReportError(VIR_ERR_OPERATION_FAILED,
-                       "%s", _("failed to read qemu header"));
         goto error;
     }
 
@@ -6255,9 +6256,10 @@ qemuDomainSaveImageOpen(virQEMUDriverPtr driver,
                     virReportSystemError(errno,
                                          _("cannot remove corrupt file: %s"),
                                          path);
-                    goto error;
+                } else {
+                    fd = -3;
                 }
-                return -3;
+                goto error;
             }
         }
         virReportError(VIR_ERR_OPERATION_FAILED, "%s", msg);