From f35a07273f252b98f65126c747bfb1eb435f0ace Mon Sep 17 00:00:00 2001 From: Dave Barach Date: Wed, 12 Jun 2019 16:50:38 -0400 Subject: infra: fix minor memory leak in "api trace..." Build api trace message print fns into the built-in copy of api_format.c Optimize memory allocator behavior when the api trace wraps. Type: Fix Change-Id: If799d8784a459f981fc9ee3a3ca03d3f63b2bcd0 Signed-off-by: Dave Barach --- src/vlibapi/api_shared.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) (limited to 'src/vlibapi/api_shared.c') diff --git a/src/vlibapi/api_shared.c b/src/vlibapi/api_shared.c index cee9cd54f5f..77a18c9e73c 100644 --- a/src/vlibapi/api_shared.c +++ b/src/vlibapi/api_shared.c @@ -97,7 +97,9 @@ vl_msg_api_trace (api_main_t * am, vl_api_trace_t * tp, void *msg) old_trace = tp->traces + tp->curindex++; if (tp->curindex == tp->nitems) tp->curindex = 0; - vec_free (*old_trace); + /* Reuse the trace record, may save some memory allocator traffic */ + msg_copy = *old_trace; + vec_reset_length (msg_copy); this_trace = old_trace; } -- cgit 1.2.3-korg