[PATCH] admin_server: Avoid accessing unallocated memory

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

 



In 68b726b93c11cc90 we tried to fix a mem leak. However, it
wasn't done quite well. Problem is, virNetDaemonGetServers() may
fail in which case virObjectListFreeCount() would be called with
-1 objects to free. But the number of elements is taken in
unsigned rather than signed integer.

Signed-off-by: Michal Privoznik <mprivozn@xxxxxxxxxx>
---

Pushed under trivial rule.

 daemon/admin_server.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/daemon/admin_server.c b/daemon/admin_server.c
index 85cec46..1d30ea5 100644
--- a/daemon/admin_server.c
+++ b/daemon/admin_server.c
@@ -54,7 +54,8 @@ adminConnectListServers(virNetDaemonPtr dmn,
         srvs = NULL;
     }
  cleanup:
-    virObjectListFreeCount(srvs, ret);
+    if (ret > 0)
+        virObjectListFreeCount(srvs, ret);
     return ret;
 }
 
-- 
2.7.3

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