[PATCH 4/4] ch: Don't leak ch_driver->chCaps

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

 



During CH driver initialization (chStateInitialize()) the
driver's capabilities bitmap is allocated
(virCHCapsInitCHVersionCaps()), but corresponding free call is
missing in chStateCleanup().

And while at it, reorder calls to virObjectUnref() inside of
chStateCleanup() to be the reverse order of that in
chStateInitialize() so that it's easier to spot missing
free/unref call.

Signed-off-by: Michal Privoznik <mprivozn@xxxxxxxxxx>
---
 src/ch/ch_driver.c | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

diff --git a/src/ch/ch_driver.c b/src/ch/ch_driver.c
index bd271fc0ee..96de5044ac 100644
--- a/src/ch/ch_driver.c
+++ b/src/ch/ch_driver.c
@@ -850,10 +850,11 @@ static int chStateCleanup(void)
     if (ch_driver == NULL)
         return -1;
 
-    virObjectUnref(ch_driver->domains);
+    virBitmapFree(ch_driver->chCaps);
+    virObjectUnref(ch_driver->config);
     virObjectUnref(ch_driver->xmlopt);
     virObjectUnref(ch_driver->caps);
-    virObjectUnref(ch_driver->config);
+    virObjectUnref(ch_driver->domains);
     virMutexDestroy(&ch_driver->lock);
     g_clear_pointer(&ch_driver, g_free);
 
-- 
2.41.0
_______________________________________________
Devel mailing list -- devel@xxxxxxxxxxxxxxxxx
To unsubscribe send an email to devel-leave@xxxxxxxxxxxxxxxxx




[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