From 22ca0d03dbc82c3eb9ccd995aaef3ae924f67b97 Mon Sep 17 00:00:00 2001 From: Ole Troan Date: Thu, 23 Mar 2023 22:09:51 +0100 Subject: stats: check if stats vector entry is empty When a stats entry is removed it is marked empty. The stats client did not check for that and returned an empty string. This resulted in blank lines in vpp_get_stats. Fix by returning null instead and checking value. Type: fix Signed-off-by: Ole Troan Change-Id: I08a39ba3ef4421bf275747a6300f97fe36791b50 --- src/vpp/app/vpp_get_stats.c | 2 ++ 1 file changed, 2 insertions(+) (limited to 'src/vpp') diff --git a/src/vpp/app/vpp_get_stats.c b/src/vpp/app/vpp_get_stats.c index a37dfca57a8..54d36abcbf2 100644 --- a/src/vpp/app/vpp_get_stats.c +++ b/src/vpp/app/vpp_get_stats.c @@ -179,6 +179,8 @@ reconnect: for (i = 0; i < vec_len (dir); i++) { char *n = stat_segment_index_to_name (dir[i]); + if (!n) + continue; printf ("%s\n", n); free (n); } -- cgit 1.2.3-korg