[libvirt] [PATCH 1/4] Fix leak in x86UpdateHostModel

Ján Tomko jtomko at redhat.com
Thu Sep 18 10:14:09 UTC 2014


Commit de0aeaf introduced a memory leak.
---
 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 7571f16..a98a847 100644
--- a/src/cpu/cpu_x86.c
+++ b/src/cpu/cpu_x86.c
@@ -2094,8 +2094,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);
+            }
         }
     }
 
-- 
1.8.5.5




More information about the libvir-list mailing list