From 58fb993b2183bc3f3c20aacfc55290f4d9cf807b Mon Sep 17 00:00:00 2001 From: navyasher Date: Tue, 21 Jul 2026 17:17:05 +0530 Subject: [PATCH] RDKB-65853: Fixing coverity issue 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: Navya_Sheregar@comcast.com --- source/core/wifi_ctrl_webconfig.c | 36 +++++++++++++++++++------------ 1 file changed, 22 insertions(+), 14 deletions(-) diff --git a/source/core/wifi_ctrl_webconfig.c b/source/core/wifi_ctrl_webconfig.c index 3bf430c85..d07568a1d 100644 --- a/source/core/wifi_ctrl_webconfig.c +++ b/source/core/wifi_ctrl_webconfig.c @@ -1861,6 +1861,24 @@ static int remove_all_mac_acl_entries_from_cache_and_db(rdk_wifi_vap_info_t *cur return RETURN_OK; } +void webconfig_free_decoded_acl_maps(webconfig_subdoc_decoded_data_t *decoded) +{ + unsigned int r, v; + wifi_mgr_t *mgr = get_wifimgr_obj(); + rdk_wifi_vap_info_t *dec_vap, *mgr_vap; + + for (r = 0; r < getNumberRadios(); r++) { + for (v = 0; v < getNumberVAPsPerRadio(r); v++) { + dec_vap = &decoded->radios[r].vaps.rdk_vap_array[v]; + mgr_vap = &mgr->radio_config[r].vaps.rdk_vap_array[v]; + if (dec_vap->acl_map != NULL && dec_vap->acl_map != mgr_vap->acl_map) { + hash_map_destroy(dec_vap->acl_map); + } + dec_vap->acl_map = NULL; + } + } +} + int webconfig_hal_mac_filter_apply(wifi_ctrl_t *ctrl, webconfig_subdoc_decoded_data_t *data, webconfig_subdoc_type_t subdoc_type) { unsigned int radio_index, vap_index; @@ -1887,8 +1905,8 @@ int webconfig_hal_mac_filter_apply(wifi_ctrl_t *ctrl, webconfig_subdoc_decoded_d } if (new_config->acl_map == current_config->acl_map) { - wifi_util_dbg_print(WIFI_MGR,"%s %d Same data returning \n", __func__, __LINE__); - return RETURN_OK; + wifi_util_dbg_print(WIFI_MGR,"%s %d Same data %d, skipping \n", __func__, __LINE__, vap_index); + continue; } if ((subdoc_type == webconfig_subdoc_type_mesh) && (isVapMeshBackhaul(data->radios[radio_index].vaps.rdk_vap_array[vap_index].vap_index)) == FALSE) { @@ -1979,18 +1997,8 @@ int webconfig_hal_mac_filter_apply(wifi_ctrl_t *ctrl, webconfig_subdoc_decoded_d } } - if ((new_config != NULL) && (new_config->acl_map != NULL)) { - new_acl_entry = hash_map_get_first(new_config->acl_map); - while (new_acl_entry != NULL) { - to_mac_str(new_acl_entry->mac,new_mac_str); - new_acl_entry = hash_map_get_next(new_config->acl_map,new_acl_entry); - temp_acl_entry = hash_map_remove(new_config->acl_map, new_mac_str); - if (temp_acl_entry != NULL) { - free(temp_acl_entry); - } - } - hash_map_destroy(new_config->acl_map); - } + /* Free all decoded ACL maps that are not aliased to the mgr's live cache */ + webconfig_free_decoded_acl_maps(data); return ret; }