| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
Sonar c:S3584 / c:S1763: spam_thread() returned directly when sendto() failed, leaking the strdup'd per-packet strings, the packets and lengths arrays, and the UDP socket fd. The cleanup at the end of the function sat after an unconditional `for (;;)` loop, so it was unreachable. Move the cleanup into the sendto() failure path (free each packets[j] string, then free packets, free lengths, close the socket) and drop the post-loop dead code. The function still has the same single exit path (early return on send failure); GCC recognises the trailing infinite loop and does not require a fall-through return.
|
Sorry, something went wrong.
|
@cubic-dev-ai review this PR |
Sorry, something went wrong.
@stelfrag I have started the AI code review. It will take a few minutes to complete. |
Sorry, something went wrong.
There was a problem hiding this comment.
This PR addresses an audit finding in the statsd-stress profiling test by ensuring resources are released on the sendto() failure path, removing dead/unreachable cleanup code after an infinite loop.
Changes:
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Sorry, something went wrong.
tests: fix statsd-stress cleanup on send-error path Sonar c:S3584 / c:S1763: spam_thread() returned directly when sendto() failed, leaking the strdup'd per-packet strings, the packets and lengths arrays, and the UDP socket fd. The cleanup at the end of the function sat after an unconditional `for (;;)` loop, so it was unreachable. Move the cleanup into the sendto() failure path (free each packets[j] string, then free packets, free lengths, close the socket) and drop the post-loop dead code. The function still has the same single exit path (early return on send failure); GCC recognises the trailing infinite loop and does not require a fall-through return. Co-authored-by: Costa Tsaousis <costa@netdata.cloud> (cherry picked from commit 38ca425)
| Back | FazBrowse Home | New Git URL |
Summary