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

Stefan Berger stefanb at linux.vnet.ibm.com
Tue Nov 23 11:45:34 UTC 2010


On 11/22/2010 02:34 PM, Eric Blake wrote:
> * 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;
>               }
>           }
Solves the problem for me.

ACK.

     Stefan




More information about the libvir-list mailing list