summaryrefslogtreecommitdiffstats
path: root/src/vlib
diff options
context:
space:
mode:
authorOle Troan <ot@cisco.com>2019-06-21 16:07:06 +0200
committerDave Wallace <dwallacelf@gmail.com>2019-06-21 16:06:19 +0000
commit7abd25b3b94e4abfeea30e4e4971ba902c3fbd53 (patch)
tree79d8f9b4325614fe89a162c2dddc5d09af798ac8 /src/vlib
parent5c588504218357bd60b79501ccf8721ff65bced3 (diff)
stats: fix memory leakage when adding / deleting interfaces
This fixes two leaks in registering errors in the stats segment. - The error name created by vlib_register_errors() was not freed. - Duplicate error names (when interface readded) was added to the vector. Change-Id: If5fe371e8059cf6678fc785cbf673707b4f4a655 Type: fix Signed-off-by: Ole Troan <ot@cisco.com>
Diffstat (limited to 'src/vlib')
-rw-r--r--src/vlib/error.c7
1 files changed, 4 insertions, 3 deletions
diff --git a/src/vlib/error.c b/src/vlib/error.c
index 1a48c9e89c2..17447b07119 100644
--- a/src/vlib/error.c
+++ b/src/vlib/error.c
@@ -109,10 +109,11 @@ vlib_error_drop_buffers (vlib_main_t * vm,
return n_buffers;
}
-void vlib_stats_register_error_index (u8 *, u64 *, u64)
+void vlib_stats_register_error_index (void *, u8 *, u64 *, u64)
__attribute__ ((weak));
void
-vlib_stats_register_error_index (u8 * notused, u64 * notused2, u64 notused3)
+vlib_stats_register_error_index (void *noutused, u8 * notused2,
+ u64 * notused3, u64 notused4)
{
};
@@ -180,7 +181,7 @@ vlib_register_errors (vlib_main_t * vm,
{
error_name = format (0, "/err/%v/%s%c", n->name, error_strings[i], 0);
/* Note: error_name consumed by the following call */
- vlib_stats_register_error_index (error_name, em->counters,
+ vlib_stats_register_error_index (oldheap, error_name, em->counters,
n->error_heap_index + i);
}
}