[libvirt] [PATCH] libvirtd: avoid a NULL dereference on error path

Matthias Bolte matthias.bolte at googlemail.com
Mon Dec 14 23:03:49 UTC 2009


2009/12/14 Jim Meyering <jim at meyering.net>:
>
>
> >From f124b132913884ced6e9fbae8233056e0e97cd0a Mon Sep 17 00:00:00 2001
> From: Jim Meyering <meyering at redhat.com>
> Date: Mon, 14 Dec 2009 16:45:11 +0100
> Subject: [PATCH] libvirtd: avoid a NULL dereference on error path
>
> * daemon/libvirtd.c (qemudDispatchServer): Since "client" may be
> NULL in the "cleanup:" block, free client->rx only when it's not.
> ---
>  daemon/libvirtd.c |    3 ++-
>  1 files changed, 2 insertions(+), 1 deletions(-)
>
> diff --git a/daemon/libvirtd.c b/daemon/libvirtd.c
> index 6b7e33d..de6fc27 100644
> --- a/daemon/libvirtd.c
> +++ b/daemon/libvirtd.c
> @@ -1422,7 +1422,8 @@ static int qemudDispatchServer(struct qemud_server *server, struct qemud_socket
>     if (client &&
>         client->tlssession) gnutls_deinit (client->tlssession);
>     close (fd);
> -    VIR_FREE(client->rx);
> +    if (client)
> +        VIR_FREE(client->rx);
>     VIR_FREE(client);
>     return -1;
>  }
> --
> 1.6.6.rc2.275.g51e2d
>

ACK.

Matthias




More information about the libvir-list mailing list