[libvirt] [PATCH 10/34] conf: use g_strdup instead of VIR_STRDUP

John Ferlan jferlan at redhat.com
Tue Oct 22 02:57:48 UTC 2019


[...]

>  virObjectEventPtr
> @@ -1635,11 +1587,8 @@ virDomainEventBlockThresholdNew(int id,
>                                   id, name, uuid)))
>          return NULL;
>  
> -    if (VIR_STRDUP(ev->dev, dev) < 0 ||
> -        VIR_STRDUP(ev->path, path) < 0) {
> -        virObjectUnref(ev);
> -        return NULL;
> -    }
> +    ev->dev = g_strdup(dev);
> +    ev->path = g_strdup(path);
>      ev->threshold = threshold;
>      ev->excess = excess;
>  
> @@ -1986,12 +1935,13 @@ virDomainQemuMonitorEventNew(int id,
>          return NULL;
>  
>      /* event is mandatory, details are optional */
> -    if (VIR_STRDUP(ev->event, event) <= 0)
> +    if (!event)

@event is defined w/ ATTRIBUTE_NONNULL in src/conf/domain_event.h and
thus causes a coverity build error.

Perhaps the ATTRIBUTE_NONNULL can be removed.. at the very least should
an error be generated if it was removed? In order to avoid the failed
for some reason due to a NULL return. I didn't dig that deep - your call
on how to handle.

John


[...]




More information about the libvir-list mailing list