On Thu, Feb 26, 2015 at 15:17:32 +0100, Michal Privoznik wrote: > This is practically copy of qemuDomObjEndAPI. The reason why is > it so widely available is to avoid code duplication, since the > function is going to be called from our bridge driver, test > driver and parallels driver too. > > Signed-off-by: Michal Privoznik <mprivozn@xxxxxxxxxx> > --- > src/conf/network_conf.c | 13 +++++++++++-- > src/conf/network_conf.h | 1 + > src/libvirt_private.syms | 1 + > 3 files changed, 13 insertions(+), 2 deletions(-) > > diff --git a/src/conf/network_conf.c b/src/conf/network_conf.c > index 7e8b867..95d8b4d 100644 > --- a/src/conf/network_conf.c > +++ b/src/conf/network_conf.c > @@ -130,6 +130,16 @@ virNetworkObjNew(void) > return NULL; > } > > +void > +virNetworkObjEndAPI(virNetworkObjPtr *net) > +{ > + if (!*net) > + return; > + > + virObjectUnlock(*net); > + *net = NULL; > +} > + > virNetworkObjListPtr virNetworkObjListNew(void) > { > virNetworkObjListPtr nets; > @@ -4240,8 +4250,7 @@ virNetworkObjIsDuplicate(virNetworkObjListPtr nets, > } > > cleanup: > - if (net) > - virObjectUnlock(net); > + virNetworkObjEndAPI(&net); > return ret; > } You should also convert the onle place in virNetworkLoadAllConfigs() to this new helper since it will also return a referenced object. I'll point out the problem later. ACK with virNetworkLoadAllConfigs tweaked too. Peter
Attachment:
signature.asc
Description: Digital signature
-- libvir-list mailing list libvir-list@xxxxxxxxxx https://www.redhat.com/mailman/listinfo/libvir-list