File libvirt-virDomainDefParseXML-set-the-argument-of-virBitmapFree-to-NULL-after-calling-virBitmapFree.patch of Package libvirt

From e2f0c7130a0de10c0a4dc40b18f9a6dbf006d768 Mon Sep 17 00:00:00 2001
Message-Id: <e2f0c7130a0de10c0a4dc40b18f9a6dbf006d768.1379450584.git.jdenemar@redhat.com>
From: "Liuji (Jeremy)" <jeremy.liu@huawei.com>
Date: Wed, 11 Sep 2013 09:47:45 +0200
Subject: [PATCH] virDomainDefParseXML: set the argument of virBitmapFree to
 NULL after calling virBitmapFree

After freeing the bitmap pointer, it must set the pointer to NULL.
This will avoid any other use of the freed memory of the bitmap pointer.

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

Signed-off-by: Liuji (Jeremy) <jeremy.liu@huawei.com>
(cherry picked from commit ef5d51d491356f1f4287aa3a8b908b183b6dd9aa)

Conflicts:
	src/conf/domain_conf.c -
        45e9d27 renamed the PLACEMENT_MODE_AUTO constant.
---
 src/conf/domain_conf.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/src/conf/domain_conf.c b/src/conf/domain_conf.c
index 0d809f6..6937a1f 100644
--- a/src/conf/domain_conf.c
+++ b/src/conf/domain_conf.c
@@ -9227,8 +9227,10 @@ static virDomainDefPtr virDomainDefParseXML(virCapsPtr caps,
                     }
 
                     /* Ignore 'nodeset' if 'placement' is 'auto' finally */
-                    if (placement_mode == VIR_DOMAIN_NUMATUNE_MEM_PLACEMENT_MODE_AUTO)
+                    if (placement_mode == VIR_DOMAIN_NUMATUNE_MEM_PLACEMENT_MODE_AUTO) {
                         virBitmapFree(def->numatune.memory.nodemask);
+                        def->numatune.memory.nodemask = NULL;
+                    }
 
                     /* Copy 'placement' of <numatune> to <vcpu> if its 'placement'
                      * is not specified and 'placement' of <numatune> is specified.
-- 
1.8.3.2

openSUSE Build Service is sponsored by