render / rpms / libvirt

Forked from rpms/libvirt 9 months ago
Clone
Blob Blame History Raw
From 310634521378f3ae84f0f73293a591681f24648f Mon Sep 17 00:00:00 2001
Message-Id: <310634521378f3ae84f0f73293a591681f24648f@dist-git>
From: =?UTF-8?q?J=C3=A1n=20Tomko?= <jtomko@redhat.com>
Date: Thu, 18 Sep 2014 11:55:52 +0200
Subject: [PATCH] Fix leak in x86UpdateHostModel

Commit de0aeaf introduced a memory leak.

(cherry picked from commit 5b5631dedf59e540661bfeac774e543d8d38531b)
https://bugzilla.redhat.com/show_bug.cgi?id=1185458
Signed-off-by: Jiri Denemark <jdenemar@redhat.com>
---
 src/cpu/cpu_x86.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/src/cpu/cpu_x86.c b/src/cpu/cpu_x86.c
index 8ced69d..341a7f5 100644
--- a/src/cpu/cpu_x86.c
+++ b/src/cpu/cpu_x86.c
@@ -2010,8 +2010,10 @@ x86UpdateHostModel(virCPUDefPtr guest,
      * features directly */
     for (i = 0; i < guest->nfeatures; i++) {
         for (feat = map->migrate_blockers; feat; feat = feat->next) {
-            if (STREQ(feat->name, guest->features[i].name))
+            if (STREQ(feat->name, guest->features[i].name)) {
+                VIR_FREE(guest->features[i].name);
                 VIR_DELETE_ELEMENT_INPLACE(guest->features, i, guest->nfeatures);
+            }
         }
     }
 
-- 
2.2.2