[PATCH v2] domain_conf: Fix memory leak when free'ing virDomainObj

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Free dom->deprecations when free'ing virDomainObj

Signed-off-by: Luke Yue <lukedyue@xxxxxxxxx>
---
 src/conf/domain_conf.c | 11 +++++++++++
 1 file changed, 11 insertions(+)

diff --git a/src/conf/domain_conf.c b/src/conf/domain_conf.c
index 09da4ab952..7e1d30bdb2 100644
--- a/src/conf/domain_conf.c
+++ b/src/conf/domain_conf.c
@@ -3730,6 +3730,16 @@ void virDomainDefFree(virDomainDef *def)
     g_free(def);
 }
 
+static void
+virDomainObjDeprecationFree(virDomainObj *dom)
+{
+    size_t i = 0;
+    for (i = 0; i < dom->ndeprecations; i++) {
+        g_free(dom->deprecations[i]);
+    }
+    g_free(dom->deprecations);
+}
+
 static void virDomainObjDispose(void *obj)
 {
     virDomainObj *dom = obj;
@@ -3742,6 +3752,7 @@ static void virDomainObjDispose(void *obj)
     if (dom->privateDataFreeFunc)
         (dom->privateDataFreeFunc)(dom->privateData);
 
+    virDomainObjDeprecationFree(dom);
     virDomainSnapshotObjListFree(dom->snapshots);
     virDomainCheckpointObjListFree(dom->checkpoints);
 }
-- 
2.32.0




[Index of Archives]     [Virt Tools]     [Libvirt Users]     [Lib OS Info]     [Fedora Users]     [Fedora Desktop]     [Fedora SELinux]     [Big List of Linux Books]     [Yosemite News]     [KDE Users]     [Fedora Tools]

  Powered by Linux