[libvirt] [PATCH] lxcFreezeContainer: avoid test-after-deref of never-NULL pointer

Eric Blake eblake at redhat.com
Mon May 17 17:34:19 UTC 2010


On 05/17/2010 11:22 AM, Jim Meyering wrote:
> This addresses another coverity-spotted "flaw".
> However, since "cgroup" is never NULL after that initial "if" stmt,
> the only penalty is that the useless cleanup test would make a reviewer
> try to figure out how cgroup could be NULL there.

ACK.

> 
>  cleanup:
> -    if (cgroup)
> -        virCgroupFree(&cgroup);
> +    virCgroupFree(&cgroup);

Is this something that the useless-if-before-free test could have
caught, rather than waiting for coverity?

-- 
Eric Blake   eblake at redhat.com    +1-801-349-2682
Libvirt virtualization library http://libvirt.org

-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 619 bytes
Desc: OpenPGP digital signature
URL: <http://listman.redhat.com/archives/libvir-list/attachments/20100517/e4339779/attachment-0001.sig>


More information about the libvir-list mailing list