summaryrefslogtreecommitdiffstats
path: root/src/vpp-api/client
diff options
context:
space:
mode:
authorAndrew Yourtchenko <ayourtch@gmail.com>2022-11-28 17:56:16 +0000
committerOle Tr�an <otroan@employees.org>2022-11-29 13:48:45 +0000
commit3f885f97f0bb812296cb549acd3c4b8fc17de0c9 (patch)
treeac5b7120498d6982b19911b775b3f7b43d1e0102 /src/vpp-api/client
parent6db2758611dd5f1cf82c0bf78cfb95230ed2786f (diff)
stats: fix the memory leak in stat_client.c
The issue can be reproduced by running "vpp_get_stats tightpoll" The root cause is that the control flow discards the "result" struct being prepared, along with pointer its allocated name. This results in a memory leak. Type: fix Change-Id: Ibf884e92314f19b983a0159fc1257b3fa0110443 Signed-off-by: Andrew Yourtchenko <ayourtch@gmail.com>
Diffstat (limited to 'src/vpp-api/client')
-rw-r--r--src/vpp-api/client/stat_client.c2
1 files changed, 2 insertions, 0 deletions
diff --git a/src/vpp-api/client/stat_client.c b/src/vpp-api/client/stat_client.c
index 2e8e1fadf8d..5bb6e9f1e56 100644
--- a/src/vpp-api/client/stat_client.c
+++ b/src/vpp-api/client/stat_client.c
@@ -287,6 +287,8 @@ copy_data (vlib_stats_entry_t *ep, u32 index2, char *name,
{
vlib_stats_entry_t *ep2;
ep2 = vec_elt_at_index (sm->directory_vector, ep->index1);
+ /* We do not intend to return the "result", avoid a leak */
+ free (result.name);
return copy_data (ep2, ep->index2, ep->name, sm);
}