[PATCH] Re: [Libvir] Segfault with invalid virConnectPtr

Richard W.M. Jones rjones at redhat.com
Thu Sep 13 08:21:37 UTC 2007


Daniel Veillard wrote:
>> @@ -786,7 +786,7 @@ virDomainGetConnect (virDomainPtr dom)
>>      DEBUG("dom=%p", dom);
>>  
>>      if (!VIR_IS_DOMAIN (dom)) {
>> -        virLibDomainError (dom, VIR_ERR_INVALID_DOMAIN, __FUNCTION__);
>> +        virLibDomainError (NULL, VIR_ERR_INVALID_DOMAIN, __FUNCTION__);
>>          return NULL;
>>      }
>>      return dom->conn;
> 
>   unclear, if there is no way the conn can be extracted, then yes,
> maybe that's true.

VIR_IS_DOMAIN returns false if:

   dom is NULL  --> we can't get the connection from a NULL pointer
or
   dom is corrupt --> we shouldn't trust dom

Rich.

-- 
Emerging Technologies, Red Hat - http://et.redhat.com/~rjones/
Registered Address: Red Hat UK Ltd, Amberley Place, 107-111 Peascod
Street, Windsor, Berkshire, SL4 1TE, United Kingdom.  Registered in
England and Wales under Company Registration No. 03798903
-------------- next part --------------
A non-text attachment was scrubbed...
Name: smime.p7s
Type: application/x-pkcs7-signature
Size: 3237 bytes
Desc: S/MIME Cryptographic Signature
URL: <http://listman.redhat.com/archives/libvir-list/attachments/20070913/320d563f/attachment-0001.bin>


More information about the libvir-list mailing list