]> git.puffer.fish Git - mirror/frr.git/commitdiff
bgpd: use XCALLOC to allocate bgpd damp array
authorStephen Hemminger <shemminger@vyatta.com>
Thu, 5 Aug 2010 17:26:30 +0000 (10:26 -0700)
committerPaul Jakma <paul@quagga.net>
Mon, 21 Mar 2011 13:15:32 +0000 (13:15 +0000)
* bgpd: (bgp_damp_parameter_set) The BGP reuse_index is not initialized
  properly.  This would cause sporadic crash when disabling dampening.  Use
  XCALLOC correctly and the right size array is initialized and no memset is
  needed.

bgpd/bgp_damp.c

index ba059f8c1b6934b7d9155328a1eb0002beeb2a64..a51388335430e5c59eb3971e7aa8950e846b2add 100644 (file)
@@ -407,14 +407,10 @@ bgp_damp_parameter_set (int hlife, int reuse, int sup, int maxsup)
   damp->reuse_list = XCALLOC (MTYPE_BGP_DAMP_ARRAY, 
                              damp->reuse_list_size 
                              * sizeof (struct bgp_reuse_node *));
-  memset (damp->reuse_list, 0x00, 
-          damp->reuse_list_size * sizeof (struct bgp_reuse_node *));  
 
   /* Reuse-array computations */
-  damp->reuse_index = XMALLOC (MTYPE_BGP_DAMP_ARRAY, 
+  damp->reuse_index = XCALLOC (MTYPE_BGP_DAMP_ARRAY,
                               sizeof(int) * damp->reuse_index_size);
-  memset (damp->reuse_index, 0x00,
-          damp->reuse_list_size * sizeof (int));
 
   reuse_max_ratio = (double)damp->ceiling/damp->reuse_limit;
   j = (exp((double)damp->max_suppress_time/damp->half_life) * log10(2.0));