[quagga-dev 252] Re: PATCH: suspected "reference leak" in zebra/zerba_rib.c

Paul Jakma paul at clubi.ie
Wed Sep 24 10:34:21 BST 2003


On Wed, 24 Sep 2003, Gilad Arnold wrote:

> Hi,
> 
> I believe that this fixes a "reference leak" (not really a memory leak, 
> but rather an inaccurate management of route node reference counters 
> that may cause excess memory consumption and possible inconsistencies -- 
> counter wrap-around, etc). Patch is against today's CVS snapshot.
> 
> I'll appreciate some feedback on this.

Index: zebra/zebra_rib.c
===================================================================
RCS file: /var/cvsroot/quagga/zebra/zebra_rib.c,v
retrieving revision 1.11
diff -c -u -r1.11 zebra_rib.c
--- zebra/zebra_rib.c	15 Jul 2003 12:52:22 -0000	1.11
+++ zebra/zebra_rib.c	24 Sep 2003 08:43:30 -0000
@@ -1575,11 +1575,14 @@
     rn->info = si->next;
   if (si->next)
     si->next->prev = si->prev;
+  route_unlock_node (rn);
   
   /* Free static route configuration. */
   if (ifname)
     XFREE (0, si->gate.ifname);
   XFREE (MTYPE_STATIC_IPV4, si);
+
+  route_unlock_node (rn);
 
   return 1;
 }

interesting.. why is it locked twice?

on a more abstract, long-term, wishful-thinking vain: I'd love to 
eradicate a lot of the implicit locking which is done in table.c. Let 
the caller decide, something worth doing?

> Thanks,
> Gilad
> 
> 
> (PS: it holds for zebra code as well, patching is trivial)

regards,
-- 
Paul Jakma	paul at clubi.ie	paul at jakma.org	Key ID: 64A2FF6A
	warning: do not ever send email to spam at dishone.st
Fortune:
"I'd crawl over an acre of 'Visual This++' and 'Integrated Development
That' to get to gcc, Emacs, and gdb.  Thank you."
(By Vance Petree, Virginia Power)



More information about the Quagga-dev mailing list