On Wed, Jul 20, 2022 at 11:00:00AM +0200, Theo Buehler wrote:
> On Wed, Jul 20, 2022 at 10:35:10AM +0200, Claudio Jeker wrote:
> > Found while working on kroute code. The network structs needs to release
> > the rtlabel reference before being freed.
> 
> Don't expand_networks() and kr_net_delete() need this as well?

expand_networks() does not use rtlabel (either a prefix-set or rtlabel is
used on a network statement but not both at once).
kr_net_delete() on the other hand probably needs something like this as
well. Need to check.

I guess spliting the code into free_network() and free_networks() would be
a good idea so that all code could use a common free function.
 
> > 
> > -- 
> > :wq Claudio
> > 
> > Index: config.c
> > ===================================================================
> > RCS file: /cvs/src/usr.sbin/bgpd/config.c,v
> > retrieving revision 1.102
> > diff -u -p -r1.102 config.c
> > --- config.c        5 Jun 2022 12:43:13 -0000       1.102
> > +++ config.c        19 Jul 2022 16:52:40 -0000
> > @@ -92,6 +92,7 @@ free_networks(struct network_head *netwo
> >  
> >     while ((n = TAILQ_FIRST(networks)) != NULL) {
> >             TAILQ_REMOVE(networks, n, entry);
> > +           rtlabel_unref(n->net.rtlabel);
> >             filterset_free(&n->net.attrset);
> >             free(n);
> >     }
> > 
> 

-- 
:wq Claudio

Reply via email to