diff options
author | Stelios Fragkakis <52996999+stelfrag@users.noreply.github.com> | 2023-02-10 09:56:44 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2023-02-10 09:56:44 +0200 |
commit | 8df421378ecfca6525ef07a2a9c37e1161f65f54 (patch) | |
tree | d0262141d6f198f998caa305d0c62b11b43ad0e9 /libnetdata | |
parent | 6db6daca180d795bf839ef93f34a049b3a242dcd (diff) |
Fix coverity issues (#14480)
* Fix coverity issues
382921
382924
382927
382928
382932
382933
382950
382990
383123
382952
382906
382908
382912
382914
382917
382918
382919
* 381508 Unchecked return value
* 382965 Dereference after null check
Diffstat (limited to 'libnetdata')
-rw-r--r-- | libnetdata/circular_buffer/circular_buffer.c | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/libnetdata/circular_buffer/circular_buffer.c b/libnetdata/circular_buffer/circular_buffer.c index b2bded1791..7ffe6b8bc7 100644 --- a/libnetdata/circular_buffer/circular_buffer.c +++ b/libnetdata/circular_buffer/circular_buffer.c @@ -16,7 +16,10 @@ struct circular_buffer *cbuffer_new(size_t initial, size_t max, size_t *statisti } void cbuffer_free(struct circular_buffer *buf) { - if(buf && buf->statistics) + if (unlikely(!buf)) + return; + + if(buf->statistics) __atomic_sub_fetch(buf->statistics, sizeof(struct circular_buffer) + buf->size, __ATOMIC_RELAXED); freez(buf->data); |