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

Wen Congyang wency at cn.fujitsu.com
Tue Nov 23 02:21:40 UTC 2010


At 2010年11月23日 03:34, Eric Blake Write:
> * 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.

This patch seems fine to me.

> 
>  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;
>              }
>          }





More information about the libvir-list mailing list