[PATCH 6/n] libvirtd: avoid memory leak on shutdown

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

 



* daemon/libvirtd.c (qemudRunLoop): Free any remaining client data.
---

Since qemudCleanup calls VIR_FREE(server), it only makes sense to
first free all of server's contents.

Probably not the most important leak to plug (it only triggers at
libvirtd exit, where the memory would be abandoned by process exit
anyways, and does not affect clients that link against libvirt as
a library), but plugging it makes leak analysis of the rest of
libvirtd easier.

 daemon/libvirtd.c |    4 ++++
 1 files changed, 4 insertions(+), 0 deletions(-)

diff --git a/daemon/libvirtd.c b/daemon/libvirtd.c
index caf51bf..791b3dc 100644
--- a/daemon/libvirtd.c
+++ b/daemon/libvirtd.c
@@ -2403,6 +2403,10 @@ cleanup:
         server->workers[i].hasThread = 0;
     }
     VIR_FREE(server->workers);
+    for (i = 0; i < server->nclients; i++)
+        qemudFreeClient(server->clients[i]);
+    server->nclients = 0;
+    VIR_SHRINK_N(server->clients, server->nclients_max, server->nclients_max);

     virMutexUnlock(&server->lock);
     return NULL;
-- 
1.7.3.2

--
libvir-list mailing list
libvir-list@xxxxxxxxxx
https://www.redhat.com/mailman/listinfo/libvir-list


[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]