Skip to content

RDKB-65853: Fixing coverity issue#1249

Open
bharathivelp wants to merge 1 commit into
rdkcentral:developfrom
bharathivelp:fix/pattern5_6
Open

RDKB-65853: Fixing coverity issue#1249
bharathivelp wants to merge 1 commit into
rdkcentral:developfrom
bharathivelp:fix/pattern5_6

Conversation

@bharathivelp

Copy link
Copy Markdown
Contributor

Reason for change: Fixing coverity issues.
Test Procedure: Build should be successful and the regression test should also succeed
Risks: Low
Priority: P1
Signed-off-by: Velpula_Bharathi@comcast.com

Copilot AI review requested due to automatic review settings July 6, 2026 15:02
@bharathivelp bharathivelp requested a review from a team as a code owner July 6, 2026 15:02

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR targets Coverity-reported issues by tightening resource cleanup in WiFi monitor/app scheduler flows, primarily around task creation/update error paths and timer task cancellation.

Changes:

  • Adds a common failure path in coordinator_create_task() to cancel the collector task and free associated structures.
  • Adjusts provider insertion/update error handling and key duplication flow in stats coordinator logic.
  • Frees scheduler timer task arguments in WHIX and LEVL when canceling scheduled work.

Reviewed changes

Copilot reviewed 3 out of 3 changed files in this pull request and generated 8 comments.

File Description
source/stats/wifi_monitor.c Adds failure cleanup logic for coordinator task creation/update and makes free_provider_list file-local.
source/apps/whix/wifi_whix.c Frees scheduler timer task args when canceling WHIX timers.
source/apps/levl/wifi_levl.c Frees scheduler timer task args when canceling LEVL timers.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread source/stats/wifi_monitor.c Outdated
Comment on lines +5411 to +5415
wifi_mon_stats_config_t *cfg = provider_elem->mon_stats_config;
if (hash_map_put((*collector_elem)->provider_list, key_copy, provider_elem) != 0) {
wifi_util_error_print(WIFI_MON, "%s:%d: hash_map_put failed\n", __func__,__LINE__);
coordinator_free_provider_elem(&provider_elem);
return RETURN_ERR;
free(cfg);
provider_elem = NULL;
Comment thread source/stats/wifi_monitor.c Outdated
Comment on lines +5495 to +5499
wifi_mon_stats_config_t *cfg = dup_provider_elem->mon_stats_config;
if (hash_map_put(collector_elem->provider_list, key_copy, provider_elem) != 0) {
wifi_util_error_print(WIFI_MON, "%s:%d: hash_map_put failed\n", __func__,__LINE__);
coordinator_free_provider_elem(&dup_provider_elem);
free(cfg);
provider_elem = NULL;
Comment on lines +1996 to +2000
if (app->data.u.whix.vap_max_client_id != 0) {
scheduler_cancel_timer_task(ctrl->sched, app->data.u.whix.vap_max_client_id);
scheduler_free_timer_task_arg(ctrl->sched, app->data.u.whix.vap_max_client_id);
app->data.u.whix.vap_max_client_id = 0;
}
Comment on lines 2024 to 2028
if (app->data.u.whix.sched_handler_id != 0) {
wifi_util_dbg_print(WIFI_APPS, "Cancelling scheduler\n");
scheduler_cancel_timer_task(ctrl->sched, app->data.u.whix.sched_handler_id);
scheduler_free_timer_task_arg(ctrl->sched, app->data.u.whix.sched_handler_id);
app->data.u.whix.sched_handler_id = 0;
Comment on lines 968 to 972
if (levl_sc_data->sched_handler_id != 0) {
scheduler_cancel_timer_task(ctrl->sched, levl_sc_data->sched_handler_id);
scheduler_free_timer_task_arg(ctrl->sched, levl_sc_data->sched_handler_id);
levl_sc_data->sched_handler_id = 0;
}
Comment on lines 1165 to 1169
if (levl_sched_data->sched_handler_id != 0) {
scheduler_cancel_timer_task(ctrl->sched, levl_sched_data->sched_handler_id);
scheduler_free_timer_task_arg(ctrl->sched, levl_sched_data->sched_handler_id);
levl_sched_data->sched_handler_id = 0;
}
Comment on lines 1470 to 1474
if (app->data.u.levl.probe_collector_sched_handler_id != 0) {
scheduler_cancel_timer_task(ctrl->sched, app->data.u.levl.probe_collector_sched_handler_id);
scheduler_free_timer_task_arg(ctrl->sched, app->data.u.levl.probe_collector_sched_handler_id);
app->data.u.levl.probe_collector_sched_handler_id = 0;
}
Comment thread source/apps/levl/wifi_levl.c

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 3 out of 3 changed files in this pull request and generated 2 comments.

Comment on lines 5412 to 5416
wifi_util_error_print(WIFI_MON, "%s:%d: hash_map_put failed\n", __func__,__LINE__);
free(key_copy);
coordinator_free_provider_elem(&provider_elem);
return RETURN_ERR;
goto fail;
}
Comment on lines 5495 to 5499
wifi_util_error_print(WIFI_MON, "%s:%d: hash_map_put failed\n", __func__,__LINE__);
free(key_copy);
coordinator_free_provider_elem(&dup_provider_elem);
return RETURN_ERR;
}
Reason for change: Fixing coverity issues.
Test Procedure: Build should be successful and the regression test should also succeed
Risks: Low
Priority: P1
Signed-off-by: Velpula_Bharathi@comcast.com
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants