Re: [libvirt PATCHv2] qemu: process: use g_new0

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



[...]

Coverity notes...

> @@ -1074,20 +1070,17 @@ qemuProcessHandleGraphics(qemuMonitorPtr mon G_GNUC_UNUSED,
>      virDomainEventGraphicsSubjectPtr subject = NULL;
>      size_t i;
>  
> -    if (VIR_ALLOC(localAddr) < 0)
> -        goto error;
> +    localAddr = g_new0(virDomainEventGraphicsAddress, 1);
>      localAddr->family = localFamily;
>      localAddr->service = g_strdup(localService);
>      localAddr->node = g_strdup(localNode);
>  
> -    if (VIR_ALLOC(remoteAddr) < 0)
> -        goto error;
> +    remoteAddr = g_new0(virDomainEventGraphicsAddress, 1);
>      remoteAddr->family = remoteFamily;
>      remoteAddr->service = g_strdup(remoteService);
>      remoteAddr->node = g_strdup(remoteNode);
>  
> -    if (VIR_ALLOC(subject) < 0)
> -        goto error;
> +    subject = g_new0(virDomainEventGraphicsSubject, 1);
>      if (x509dname) {
>          if (VIR_REALLOC_N(subject->identities, subject->nidentity+1) < 0)
>              goto error;

There's no way to error: now w/o @localAddr, @remoteAddr, & @subject
being allocated, thus there's no need to check whether they're non-null
before accessing.


John

[...]




[Index of Archives]     [Virt Tools]     [Libvirt Users]     [Lib OS Info]     [Fedora Users]     [Fedora Desktop]     [Fedora SELinux]     [Big List of Linux Books]     [Yosemite News]     [KDE Users]     [Fedora Tools]

  Powered by Linux