summaryrefslogtreecommitdiff
path: root/bgpd
diff options
context:
space:
mode:
authorStephen Hemminger <shemminger@vyatta.com>2010-08-05 10:26:30 -0700
committerPaul Jakma <paul@quagga.net>2011-03-21 13:15:32 +0000
commitfac9c6b63aa74b34a22c89f005f7241d65a1765a (patch)
tree5ae640ab0541712f8c794ad394558d2974d8e5cf /bgpd
parent6c88b44dcb26b60bb1f93e5c387aa102019ed849 (diff)
bgpd: use XCALLOC to allocate bgpd damp array
* 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.
Diffstat (limited to 'bgpd')
-rw-r--r--bgpd/bgp_damp.c6
1 files changed, 1 insertions, 5 deletions
diff --git a/bgpd/bgp_damp.c b/bgpd/bgp_damp.c
index ba059f8c..a5138833 100644
--- a/bgpd/bgp_damp.c
+++ b/bgpd/bgp_damp.c
@@ -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));