
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@redhat.com +1-919-301-3266 Libvirt virtualization library http://libvirt.org