diff options
author | Andrew Yourtchenko <ayourtch@gmail.com> | 2021-02-22 01:01:43 +0000 |
---|---|---|
committer | Florin Coras <florin.coras@gmail.com> | 2021-02-22 22:28:15 +0000 |
commit | 6baa45cbf40f800fa1982ba8363a2ebf55b69328 (patch) | |
tree | f1c068c42d1038433f73f43b353edf273824c4b1 /src | |
parent | cbb5e824afc3f6de0663e7b9a201d4c281c36ec0 (diff) |
api: fix memory leak in vl_api_cli_inband_t_handler
I noticed the memory leak while sending a lot of cli_inband APIs:
DBGvpp# memory-trace on main-heap
... send a lot of API cli_inband ...
DBGvpp# show memory main-heap
Thread 0 vpp_main
base 0x7f85c8302000, size 1g, locked, unmap-on-destroy, name 'main heap'
page stats: page-size 4K, total 262144, mapped 33129, not-mapped 229015
numa 0: 33129 pages, 129.41m bytes
total: 1023.99M, used: 125.78M, free: 898.22M, trimmable: 897.59M
Bytes Count Sample Traceback
9751632 145034 0x7f85d01696e8 clib_mem_alloc_aligned_at_offset + 0x80
vec_resize_allocate_memory + 0xa8
_vec_resize_inline + 0x240
va_unformat + 0xe4
unformat + 0x159
vlib_cli_dispatch_sub_commands + 0x11e
vlib_cli_input + 0x8f
vl_api_cli_inband_t_handler + 0xd9
vl_msg_api_handler_with_vm_node + 0x488
void_mem_api_handle_msg_i + 0x6f
vl_mem_api_handle_msg_main + 0x38
vl_api_clnt_process + 0x28d
9723904 145034 0x7f85cd677238 clib_mem_alloc_aligned_at_offset + 0x80
vec_resize_allocate_memory + 0xa8
_vec_resize_inline + 0x240
unformat_init_string + 0x10d
vl_api_cli_inband_t_handler + 0xc1
vl_msg_api_handler_with_vm_node + 0x488
void_mem_api_handle_msg_i + 0x6f
vl_mem_api_handle_msg_main + 0x38
vl_api_clnt_process + 0x28d
vlib_process_bootstrap + 0x5d
0x7f8608b0e038
290077 total traced objects
Solution: free the input data structure.
Type: fix
Change-Id: I42de5572e8760237e793a53c1a94bce65a4ac5fa
Signed-off-by: Andrew Yourtchenko <ayourtch@gmail.com>
Diffstat (limited to 'src')
-rw-r--r-- | src/vpp/api/api.c | 1 |
1 files changed, 1 insertions, 0 deletions
diff --git a/src/vpp/api/api.c b/src/vpp/api/api.c index 6007b723ceb..cd5bc726d26 100644 --- a/src/vpp/api/api.c +++ b/src/vpp/api/api.c @@ -225,6 +225,7 @@ vl_api_cli_inband_t_handler (vl_api_cli_inband_t * mp) unformat_init_string (&input, (char *) cmd_vec, vl_api_string_len (&mp->cmd)); rv = vlib_cli_input (vm, &input, inband_cli_output, (uword) & out_vec); + unformat_free (&input); error: /* *INDENT-OFF* */ |