RDKB-65853: Fixing coverity issue#1249
Open
bharathivelp wants to merge 1 commit into
Open
Conversation
Contributor
There was a problem hiding this comment.
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 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 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; | ||
| } |
7b8d2c0 to
3a23acb
Compare
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
3a23acb to
e949051
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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