On 09/22/2015 04:35 PM, Yang Hongyang wrote: > > > On 09/22/2015 04:31 PM, Jason Wang wrote: > [...] >>>>> + /* setup filter */ >>>>> + nfqc = NETFILTER_GET_CLASS(obj); >>>>> + if (nfqc->setup) { >>>>> + nfqc->setup(nfq, &local_err); >>>>> + if (local_err) { >>>>> + error_propagate(errp, local_err); >>>>> + goto out; >>>>> + } >>>>> + } >>>>> + QTAILQ_INSERT_TAIL(&nfq->netdev->filters, nfq, next); >>>>> + object_unref(obj); >>> ^^^^^^^^^^^^ >>> >>>>> + } >>>>> + >>>>> + if (proptable) { >>>>> + g_hash_table_unref(proptable); >>>>> + } >>>>> + return; >>>>> + >>>>> +out: >>>> >>>> We may leak objects here. >>> >>> Seems not. see above object_unref(), if we come to >>> here, object create in previous iter will be unrefed. >> >> Maybe I miss something. But there's still refcnt for objects created in >> previous iters? (I mean object_property_add_child() will add another >> refcnt?) > > This is intended, parent need to hold a refcnt of it's child. When we > delete the parent, it will release the child refcnt, and it's child > obj will be > automatically deleted because the refcnt is decreased to 0. > The object_unref() release the refcnt hold by object_new().
I see. Thanks.