[libvirt] [PATCH 23/49] list: Implement listAllNetworks for network driver

Eric Blake eblake at redhat.com
Mon Jul 23 21:36:34 UTC 2012


On 07/23/2012 03:12 PM, Laine Stump wrote:
> On 07/20/2012 10:25 AM, Osier Yang wrote:
>> src/network/bridge_driver.c: Implement listAllNetworks.
>> ---
>>  src/network/bridge_driver.c |   18 ++++++++++++++++++
>>  1 files changed, 18 insertions(+), 0 deletions(-)

>>  
>> +static int
>> +networkListAllNetworks(virConnectPtr conn,
>> +                       virNetworkPtr **nets,
>> +                       unsigned int flags)
>> +{
>> +    struct network_driver *driver = conn->networkPrivateData;
>> +    int ret = -1;
>> +
>> +    virCheckFlags(VIR_CONNECT_LIST_NETWORKS_FILTERS_ALL, -1);
> 
> If you return with an error here, nets will be unset. Even though a
> *sane* caller would check the return value prior to dereferencing
> anything in nets, it would still be a good idea to to "*nets = NULL"
> before anything else.

Then again. libvirt.c _already_ did *nets=NULL before getting into this
driver callback.

-- 
Eric Blake   eblake at 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: 620 bytes
Desc: OpenPGP digital signature
URL: <http://listman.redhat.com/archives/libvir-list/attachments/20120723/ad5c90d9/attachment-0001.sig>


More information about the libvir-list mailing list