render / rpms / libvirt

Forked from rpms/libvirt 9 months ago
Clone
Blob Blame History Raw
From 739e3d6333e8e02a9403be18502af9a8866b0c73 Mon Sep 17 00:00:00 2001
Message-Id: <739e3d6333e8e02a9403be18502af9a8866b0c73.1379597660.git.jdenemar@redhat.com>
From: Peter Krempa <pkrempa@redhat.com>
Date: Wed, 18 Sep 2013 09:28:12 +0200
Subject: [PATCH] qemu: Fix memleak after commit
 59898a88ce8431bd3ea249b8789edc2ef9985827
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit

https://bugzilla.redhat.com/show_bug.cgi?id=1008340

If the ABI compatibility check with the "migratable" user XML is
successful, we would leak the originally parsed XML from the user that
would not be used in this case.

Reported by Ján Tomko.

(cherry picked from commit 044e3e75248f0346f9dfd181a90f7d16d69ed482)
---
 src/qemu/qemu_driver.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/src/qemu/qemu_driver.c b/src/qemu/qemu_driver.c
index 71d773c..53cb1ec 100644
--- a/src/qemu/qemu_driver.c
+++ b/src/qemu/qemu_driver.c
@@ -5335,6 +5335,8 @@ qemuDomainSaveImageOpen(virQEMUDriverPtr driver,
             /* use the user provided XML */
             newdef = def2;
             def2 = NULL;
+        } else {
+            virDomainDefFree(def2);
         }
 
         virDomainDefFree(def);
-- 
1.8.3.2