[libvirt] [PATCH] virpcitest: fix coverity issues

Eric Blake eblake at redhat.com
Thu Feb 6 15:48:32 UTC 2014


On 02/06/2014 08:18 AM, Pavel Hrdina wrote:
> The coverity server complains about the dev->stubDriver that it was
> freed by the virPCIDeviceSetStubDriver function, but it somehow don't
> get the fact that into the variable is immediately assigned new string.
> 
> Signed-off-by: Pavel Hrdina <phrdina at redhat.com>
> ---
>  tests/virpcitest.c | 2 ++
>  1 file changed, 2 insertions(+)

What's the exact complaint?

> 
> diff --git a/tests/virpcitest.c b/tests/virpcitest.c
> index 994b300..8ff3b1d 100644
> --- a/tests/virpcitest.c
> +++ b/tests/virpcitest.c
> @@ -248,6 +248,7 @@ testVirPCIDeviceDetachSingle(const void *opaque)
>      if (!dev)
>          goto cleanup;
>  
> +    /* coverity[freed_arg] */
>      if (virPCIDeviceSetStubDriver(dev, "pci-stub") < 0 ||
>          virPCIDeviceDetach(dev, NULL, NULL) < 0)
>          goto cleanup;

Is this something where an sa_assert() could do the trick in a more
tool-agnostic manner?

-- 
Eric Blake   eblake redhat com    +1-919-301-3266
Libvirt virtualization library http://libvirt.org

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


More information about the libvir-list mailing list