[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]

Re: [libvirt] PATCH: 1/2: port Test driver to network APIs



"Daniel P. Berrange" <berrange redhat com> 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?


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]