aboutsummaryrefslogtreecommitdiffstats
path: root/src/vlibapi/api_shared.c
diff options
context:
space:
mode:
authorDave Barach <dave@barachs.net>2019-06-12 16:50:38 -0400
committerFlorin Coras <florin.coras@gmail.com>2019-06-12 21:58:33 +0000
commitf35a07273f252b98f65126c747bfb1eb435f0ace (patch)
treeddd1f99c11d539bfb9d20fa5311f27dcc344ed3e /src/vlibapi/api_shared.c
parent0f87dfeec6c38035e6fbcfdd9a33c60c51f9514e (diff)
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 <dave@barachs.net>
Diffstat (limited to 'src/vlibapi/api_shared.c')
-rw-r--r--src/vlibapi/api_shared.c4
1 files changed, 3 insertions, 1 deletions
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;
}