On Fri, Jan 01, 2010 at 08:40:24PM -0500, Laine Stump wrote: > --- > src/conf/interface_conf.c | 32 +++++++++++++++++--------------- > 1 files changed, 17 insertions(+), 15 deletions(-) > > diff --git a/src/conf/interface_conf.c b/src/conf/interface_conf.c > index ca82208..d7821e7 100644 > --- a/src/conf/interface_conf.c > +++ b/src/conf/interface_conf.c > @@ -557,28 +557,30 @@ virInterfaceDefParseBridge(virConnectPtr conn, virInterfaceDefPtr def, > > bridge = ctxt->node; > nbItf = virXPathNodeSet(conn, "./interface", ctxt, &interfaces); > - if (nbItf <= 0) { > + if (nbItf < 0) { > virInterfaceReportError(conn, VIR_ERR_XML_ERROR, > - "%s", _("bridge has no interfaces")); > + "%s", _("bridge interfaces")); > ret = -1; > goto error; > } > - if (VIR_ALLOC_N(def->data.bridge.itf, nbItf) < 0) { > - virReportOOMError(conn); > - ret = -1; > - goto error; > - } > - def->data.bridge.nbItf = nbItf; > - > - for (i = 0; i < nbItf;i++) { > - ctxt->node = interfaces[i]; > - itf = virInterfaceDefParseBareInterface(conn, ctxt, 0); > - if (itf == NULL) { > + if (nbItf > 0) { > + if (VIR_ALLOC_N(def->data.bridge.itf, nbItf) < 0) { > + virReportOOMError(conn); > ret = -1; > - def->data.bridge.nbItf = i; > goto error; > } > - def->data.bridge.itf[i] = itf; > + def->data.bridge.nbItf = nbItf; > + > + for (i = 0; i < nbItf;i++) { > + ctxt->node = interfaces[i]; > + itf = virInterfaceDefParseBareInterface(conn, ctxt, 0); > + if (itf == NULL) { > + ret = -1; > + def->data.bridge.nbItf = i; > + goto error; > + } > + def->data.bridge.itf[i] = itf; > + } > } > > error: ACK Daniel -- |: Red Hat, Engineering, London -o- http://people.redhat.com/berrange/ :| |: http://libvirt.org -o- http://virt-manager.org -o- http://ovirt.org :| |: http://autobuild.org -o- http://search.cpan.org/~danberr/ :| |: GnuPG: 7D3B9505 -o- F3C9 553F A1DA 4AC2 5648 23C1 B3DF F742 7D3B 9505 :| -- libvir-list mailing list libvir-list@xxxxxxxxxx https://www.redhat.com/mailman/listinfo/libvir-list