Hello list,

I have a query related to the stat_client. Its query is related to 
client/stat_client.c, part of shared library vppapiclient.

In src/vpp-api/client/stat_client.c (master branch):

stat_segment_data_t *res = 0; ==> LINE 1
...
...
for (i = 0; i < vec_len (stats); i++)
{
/* Collect counter */
ep = vec_elt_at_index (sm->directory_vector, stats[i]);
vec_add1 (res, copy_data (ep, ~0, 0, sm)); ==> LINE 2
}

if (stat_segment_access_end (&sa, sm)) ==> LINE 3
return res;
fprintf (stderr, "Epoch changed while reading, invalid results\n");
// TODO increase counter
return 0;

in LINE 3 , if the condition is False (epoch changed), then we return 0
in that case, in LINE 2 'res' might have already allocated memory and this 
memory no longer get free'd.

Is this understanding correct?

If that case, this may trigger memory leak in vpp_prometheus_export(uses 
libvppapiclient), as it cannot get hold of the allocated memory(res) handle to 
free.

Thanks,

X.
-=-=-=-=-=-=-=-=-=-=-=-
Links: You receive all messages sent to this group.
View/Reply Online (#19837): https://lists.fd.io/g/vpp-dev/message/19837
Mute This Topic: https://lists.fd.io/mt/84335081/21656
Group Owner: vpp-dev+ow...@lists.fd.io
Unsubscribe: https://lists.fd.io/g/vpp-dev/unsub [arch...@mail-archive.com]
-=-=-=-=-=-=-=-=-=-=-=-

Reply via email to