stats: return empty vector rather than NULL if stat_segment_dump_r() is run on an... 44/37744/2
authorAndrew Yourtchenko <ayourtch@gmail.com>
Fri, 2 Dec 2022 21:22:37 +0000 (21:22 +0000)
committerOle Tr�an <otroan@employees.org>
Mon, 5 Dec 2022 09:50:18 +0000 (09:50 +0000)
commit9067f3332ed0ddc143105b003e614f3f90719916
tree9877de9a294f4c39c061c4a7db76090db3268ad2
parent309f7aac170767028a2e6e7e9424ec3d13304aff
stats: return empty vector rather than NULL if stat_segment_dump_r() is run on an empty vector from ls

The return value in this function is initialized with 0, so if a vector of length 0 is passed
to stat_segment_dump_r, then this return value is never populated, resulting in inability
to distinguish between a successful dump of an empty vector and an error.

Solution: call vec_alloc(). As a side effect might get some trivial speed-up.

Type: fix
Signed-off-by: Andrew Yourtchenko <ayourtch@gmail.com>
Change-Id: I33fefd801df457152e9ec257742305182e91f339
src/vpp-api/client/stat_client.c