@cryptotaxi247 / netdata-1 / commits / 5b0508332

Fix based on Coverity and Sonar audits (part 10) (#22338)

mcp: drop redundant null guard from interrupt-callback stub Sonar c:S3923: mcp_query_interrupt_callback() had a null guard (`if (!int_data || !int_data->mcpc) return false;`) followed by an unconditional `return false`. Both branches returned the same value and no field of int_data was ever dereferenced, so the guard was dead code. Remove the conditional, mark `data` unused with `(void)data;`, and keep the callback as an explicit "no interrupt" stub. The trailing comment about future client-disconnect/timeout detection is preserved. Co-authored-by: Costa Tsaousis <costa@netdata.cloud>

Stelios Fragkakis committed May 1, 2026 at 11:14 UTC 5b0508332fde262a734240d1893b17ae512571e2
1 file changed +2 -6
src/web/mcp/mcp-tools-query-metrics.c
+2 -6
@@ -279,12 +279,8 @@ typedef struct {
279
280 // Interrupt callback for query execution
281 static bool mcp_query_interrupt_callback(void *data) {
282 - mcp_query_interrupt_data *int_data = (mcp_query_interrupt_data *)data;
283 -
284 - // Check if the MCP client is still valid and connected
285 - if (!int_data || !int_data->mcpc)
286 - return false;
287 -
282 + (void)data;
283 +
284 // Real implementations might check for client disconnection or timeout
285 // Here we're just returning false to indicate "no interrupt"
286 return false;