[libvirt] [PATCH] libvirtd: fix bug when shrinking number of clients

Eric Blake eblake at redhat.com
Mon Nov 22 19:34:22 UTC 2010


* daemon/libvirtd.c (qemudRunLoop): Pass allocation size, not
current count, to VIR_SHRINK_N.
---

Found the cause of the crash; when the first loop completed, it was
freeing the array but not reflecting that in the allocation count;
the second time then saw the non-zero allocation count and didn't
think it had to allocate anything.

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

diff --git a/daemon/libvirtd.c b/daemon/libvirtd.c
index e544c48..7f75096 100644
--- a/daemon/libvirtd.c
+++ b/daemon/libvirtd.c
@@ -2362,2 +2362,2 @@ static void *qemudRunLoop(void *opaque) {
                             server->clients + i + 1,
                             sizeof (*server->clients) * (server->nclients - i));

-                VIR_SHRINK_N(server->clients, server->nclients, 0);
+                VIR_SHRINK_N(server->clients, server->nclients_max, 1);
                 goto reprocess;
             }
         }
-- 
1.7.3.2




More information about the libvir-list mailing list