@cryptotaxi247 / netdata-1 / commits / b132229cf

Fix based on Coverity and Sonar audits (part 2) (#22330)

* exporting: fix bare return in aws_kinesis_connector_worker UNIT_TESTING branch Sonar c:S935 (CRITICAL): aws_kinesis_connector_worker() is declared void *, but the conditional test-only early exit inside #ifdef UNIT_TESTING used a bare `return;`. Per C99/C11 6.8.6.4, a return without an expression is only permitted in a function whose return type is void. Production builds skip this block, but enabling UNIT_TESTING fails to compile. Change the bare return to `return NULL;` so test builds satisfy the function signature; production control flow is unchanged. * exporting: fix bare return in pubsub_connector_worker UNIT_TESTING branch Sonar c:S935 (CRITICAL): pubsub_connector_worker() is declared void *, but the conditional test-only early exit inside #ifdef UNIT_TESTING used a bare `return;`. Per C99/C11 6.8.6.4, a return without an expression is only permitted in a function whose return type is void. Production builds skip this block, but enabling UNIT_TESTING fails to compile. Same pattern as aws_kinesis.c:214 fixed in the previous commit. * exporting: fix value-returning bare return in exporting_main UNIT_TESTING branch Sonar c:S935 (CRITICAL): exporting_main() is declared void, but the conditional test-only early exit inside #ifdef UNIT_TESTING used `return NULL;`, which is invalid for a void-returning function per C99/C11 6.8.6.4. Production builds skip the block, but enabling UNIT_TESTING fails to compile. Change the conditional return to a bare `return;`, and remove the stale "@return It always returns NULL" line from the function's docstring (left behind from when the signature was void *). Together with the previous two commits, this closes the c:S935 trio across the exporting subsystem (aws_kinesis, pubsub, exporting_engine). * Update src/exporting/pubsub/pubsub.c Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com> * Update src/exporting/aws_kinesis/aws_kinesis.c Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com> * Update src/exporting/exporting_engine.c Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com> --------- Co-authored-by: Costa Tsaousis <costa@netdata.cloud> Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>

Stelios Fragkakis committed May 1, 2026 at 13:25 UTC b132229cfd0a454a773746dc014c7a58de409215
3 files changed +3 -4
src/exporting/aws_kinesis/aws_kinesis.c
+1 -1
@@ -211,7 +211,7 @@ void *aws_kinesis_connector_worker(void *instance_p)
211 netdata_mutex_unlock(&instance->mutex);
212
213 #ifdef UNIT_TESTING
214 - return;
214 + break;
215 #endif
216 }
217
src/exporting/exporting_engine.c
+1 -2
@@ -182,7 +182,6 @@ static void exporting_main_cleanup(void *pptr)
182 *
183 * @param ptr a pointer to netdata_static_structure.
184 *
185 - * @return It always returns NULL.
185 */
186 void exporting_main(void *ptr)
187 {
@@ -217,7 +216,7 @@ void exporting_main(void *ptr)
216 send_main_rusage(st_main_rusage, rd_main_user, rd_main_system);
217
218 #ifdef UNIT_TESTING
220 - return NULL;
219 + break;
220 #endif
221 }
222 service_exits();
src/exporting/pubsub/pubsub.c
+1 -1
@@ -187,7 +187,7 @@ void *pubsub_connector_worker(void *instance_p)
187 netdata_mutex_unlock(&instance->mutex);
188
189 #ifdef UNIT_TESTING
190 - return;
190 + break;
191 #endif
192 }
193