[libvirt] [PATCH 4/5] util: Avoid Coverity FORWARD_NULL

Laine Stump laine at laine.org
Fri Sep 4 17:46:56 UTC 2015


On 09/04/2015 10:31 AM, John Ferlan wrote:
> Coverity claims it could be possible to call virDBusTypeStackFree with
> *stack == NULL and although the two API's that call it don't appear to
> allow that - I suppose it's better to be safe than sorry
>
> Signed-off-by: John Ferlan <jferlan at redhat.com>
> ---
>   src/util/virdbus.c | 4 ++++
>   1 file changed, 4 insertions(+)
>
> diff --git a/src/util/virdbus.c b/src/util/virdbus.c
> index 1cf1eef..78fb795 100644
> --- a/src/util/virdbus.c
> +++ b/src/util/virdbus.c
> @@ -544,6 +544,10 @@ static void virDBusTypeStackFree(virDBusTypeStack **stack,
>                                    size_t *nstack)
>   {
>       size_t i;
> +
> +    if (!*stack)
> +        return;
> +
>       /* The iter in the first level of the stack is the
>        * root iter which must not be freed
>        */

ACK.




More information about the libvir-list mailing list