aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSteven Luong <sluong@cisco.com>2022-08-18 13:20:30 -0700
committerMatthew Smith <mgsmith@netgate.com>2022-08-19 15:06:42 +0000
commitc428fd5d9476baba02edc0a10552719460e85b1e (patch)
tree568c81b469d0950fec4ef22bf41fa77c25cddf4d
parent6f1eb484c85cfdb091cbef18252a02b3310b9aae (diff)
vlib: memory leak in vlib_register_errors on create and delete interface
format returns a vector which must be free or memory is leaked. From show memory 3716528 66716 0x7fffbfeb0db0 _vec_resize_internal + 0xe6 _vec_add + 0x164 do_percent + 0xb82 va_format + 0xb9 format + 0x156 vlib_register_errors + 0x76c setup_tx_node + 0x5c vnet_register_interface + 0xca6 vnet_eth_register_interface + 0xdd memif_create_if + 0x975 memif_create_command_fn + 0x461 vlib_cli_dispatch_sub_commands + 0xec8 (gdb) list *(vlib_register_errors + 0x76c) 0x7ffff6e8280c is in vlib_register_errors (/home/sluong/vpp/vpp/src/vlib/error.c:224). 219 220 vec_validate (nm->node_by_error, n->error_heap_index + n_errors - 1); 221 222 for (u32 i = 0; i < n_errors; i++) 223 { 224 t.format = (char *) format (0, "%v %s: %%d", n->name, cd[i].name); 225 vm->error_elog_event_types[n->error_heap_index + i] = t; 226 nm->node_by_error[n->error_heap_index + i] = n->index; 227 } Type: fix Signed-off-by: Steven Luong <sluong@cisco.com> Change-Id: I2983f081b7e2c1b2d18d66afe45282933efbe127
-rw-r--r--src/vlib/error.c1
1 files changed, 1 insertions, 0 deletions
diff --git a/src/vlib/error.c b/src/vlib/error.c
index 7e72565d47f..de2020f08cb 100644
--- a/src/vlib/error.c
+++ b/src/vlib/error.c
@@ -222,6 +222,7 @@ vlib_register_errors (vlib_main_t *vm, u32 node_index, u32 n_errors,
for (u32 i = 0; i < n_errors; i++)
{
t.format = (char *) format (0, "%v %s: %%d", n->name, cd[i].name);
+ vec_free (vm->error_elog_event_types[n->error_heap_index + i].format);
vm->error_elog_event_types[n->error_heap_index + i] = t;
nm->node_by_error[n->error_heap_index + i] = n->index;
}