"Daniel P. Berrange" <berrange@xxxxxxxxxx> wrote: > On Wed, Jul 02, 2008 at 10:13:00PM +0200, Jim Meyering wrote: >> > static virNetworkPtr testNetworkCreate(virConnectPtr conn, const char *xml) { >> > - int handle = -1; >> > - virNetworkPtr net; >> > + virNetworkDefPtr def; >> > + virNetworkObjPtr net; >> > GET_CONNECTION(conn, NULL); >> > >> > - if (xml == NULL) { >> > - testError(conn, NULL, NULL, VIR_ERR_INVALID_ARG, __FUNCTION__); >> > - return (NULL); >> > - } >> > + if ((def = virNetworkDefParse(conn, xml, NULL)) == NULL) >> > + return NULL; >> > ... >> > + if ((net = virNetworkAssignDef(conn, &privconn->networks, >> > + def)) == NULL) >> >> Don't we need to call virNetworkDefFree(def) before returning? > > No need as the 'net' object holds a pointer to the 'def' But inside that if-block (where the function returns), "net" is NULL. Am I'm missing something? -- Libvir-list mailing list Libvir-list@xxxxxxxxxx https://www.redhat.com/mailman/listinfo/libvir-list