Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
32 changes: 20 additions & 12 deletions lib/datapipeline/dppline.c
Original file line number Diff line number Diff line change
Expand Up @@ -346,7 +346,11 @@ static bool dppline_copysts(dppline_stats_t * dst, void * sts)
dst->u.survey.list = calloc(1, size);
}
else {
dst->u.survey.list = realloc(dst->u.survey.list, size);
void *tmp = realloc(dst->u.survey.list, size);
if (!tmp) {
return false;
}
dst->u.survey.list = tmp;
Comment thread
navyasher marked this conversation as resolved.
memset(&dst->u.survey.list[dst->u.survey.qty],
0,
sizeof(dpp_survey_record_t));
Expand Down Expand Up @@ -578,7 +582,7 @@ static bool dppline_copysts(dppline_stats_t * dst, void * sts)
thermal_record != NULL;
thermal_record = ds_dlist_inext(&result_iter))
{
thermal_size += (dst->u.device.thermal_qty + 1) * sizeof(dpp_device_thermal_record_t);
thermal_size = (dst->u.device.thermal_qty + 1) * sizeof(dpp_device_thermal_record_t);
if (!dst->u.device.thermal_qty)
{
dst->u.device.thermal_list = calloc(1, thermal_size);
Expand Down Expand Up @@ -693,31 +697,35 @@ static bool dppline_copysts(dppline_stats_t * dst, void * sts)

dst->u.client_auth_fails.radio_type = report_data->radio_type;
ds_dlist_iforeach(&report_data->bsses, bss_entry, bss_iter) {
const size_t bss_size = (dst->u.client_auth_fails.qty + 1) * sizeof(dpp_client_auth_fails_bss_t);
const size_t bss_size = (dst->u.client_auth_fails.qty + 1) * sizeof(dppline_client_auth_fails_bss_rec_t);
if (!dst->u.client_auth_fails.qty) {
dst->u.client_auth_fails.list = calloc(1, bss_size);
}
else {
dst->u.client_auth_fails.list = realloc(dst->u.client_auth_fails.list, bss_size);
if (!dst->u.client_auth_fails.list)
continue;
void *tmp = realloc(dst->u.client_auth_fails.list, bss_size);
if (!tmp) {
return false;
}
dst->u.client_auth_fails.list = tmp;

memset(&dst->u.client_auth_fails.list[dst->u.client_auth_fails.qty], 0, sizeof(dpp_client_auth_fails_bss_t));
memset(&dst->u.client_auth_fails.list[dst->u.client_auth_fails.qty], 0, sizeof(dppline_client_auth_fails_bss_rec_t));
}

STRSCPY_WARN(dst->u.client_auth_fails.list[dst->u.client_auth_fails.qty].if_name, bss_entry->if_name);
ds_dlist_iforeach(&bss_entry->clients, client_entry, client_iter) {
dppline_client_auth_fails_bss_rec_t *dst_bss = &dst->u.client_auth_fails.list[dst->u.client_auth_fails.qty];
const size_t client_size = (dst_bss->qty + 1) * sizeof(dpp_client_auth_fails_client_t);
const size_t client_size = (dst_bss->qty + 1) * sizeof(dppline_client_auth_fails_client_rec_t);
if (!dst_bss->qty) {
dst_bss->list = calloc(1, client_size);
}
else {
dst_bss->list = realloc(dst_bss->list, client_size);
if (!dst_bss->list)
continue;
void *tmp = realloc(dst_bss->list, client_size);
if (!tmp) {
return false;
}
dst_bss->list = tmp;
Comment thread
navyasher marked this conversation as resolved.

memset(&dst_bss->list[dst_bss->qty], 0, sizeof(dpp_client_auth_fails_client_t));
memset(&dst_bss->list[dst_bss->qty], 0, sizeof(dppline_client_auth_fails_client_rec_t));
}

STRSCPY_WARN(dst_bss->list[dst_bss->qty].mac, client_entry->mac);
Expand Down
1 change: 1 addition & 0 deletions source/apps/harvester/wifi_harvester.c
Original file line number Diff line number Diff line change
Expand Up @@ -593,6 +593,7 @@ void upload_single_client_msmt_data(sta_data_t *sta_info)
}
//Free up memory
avro_value_decref(&adr);
avro_value_iface_decref(iface);
avro_writer_free(writer);

size += MAGIC_NUMBER_SIZE + SCHEMA_ID_LENGTH;
Expand Down
13 changes: 10 additions & 3 deletions source/core/services/vap_svc_mesh_ext.c
Original file line number Diff line number Diff line change
Expand Up @@ -1843,10 +1843,17 @@ int process_ext_scan_results(vap_svc_t *svc, void *arg)
scan_list = ext->candidates_list.scan_list;
ext->candidates_list.scan_count = num;
} else if (num) {
ext->candidates_list.scan_list = (bss_candidate_t *) realloc(ext->candidates_list.scan_list,
bss_candidate_t *tmp = (bss_candidate_t *) realloc(ext->candidates_list.scan_list,
((num + ext->candidates_list.scan_count) * sizeof(bss_candidate_t)));
Comment thread
navyasher marked this conversation as resolved.
scan_list = ext->candidates_list.scan_list + ext->candidates_list.scan_count;
ext->candidates_list.scan_count += num;
if (tmp == NULL) {
wifi_util_error_print(WIFI_CTRL, "%s:%d: realloc failed\n", __func__, __LINE__);
return 0;
}
else {
ext->candidates_list.scan_list = tmp;
scan_list = ext->candidates_list.scan_list + ext->candidates_list.scan_count;
ext->candidates_list.scan_count += num;
}
}

for (i = 0; i < num; i++) {
Expand Down
11 changes: 8 additions & 3 deletions source/dml/tr_181/ml/cosa_apis_util.c
Original file line number Diff line number Diff line change
Expand Up @@ -1144,10 +1144,14 @@ int CosaUtilGetIpv6AddrInfo (char * ifname, ipv6_addr_info_t ** pp_info, int * p
parsingResult=parseProcfileParams(procLine, &v6Details,ifname);
if (parsingResult == 1)
{
(*p_num)++;
*pp_info = realloc(*pp_info, *p_num * sizeof(ipv6_addr_info_t));
if (!*pp_info)
const int new_num = (*p_num) + 1;
ipv6_addr_info_t *tmp = realloc(*pp_info, new_num * sizeof(ipv6_addr_info_t));
Comment thread
navyasher marked this conversation as resolved.
if (!tmp) {
fclose(fp);
return -1;
}
*pp_info = tmp;
*p_num = new_num;
Comment thread
navyasher marked this conversation as resolved.
p_ai = &(*pp_info)[*p_num-1];
strncpy(p_ai->v6addr, v6Details.address6, sizeof(p_ai->v6addr));

Expand All @@ -1166,6 +1170,7 @@ int CosaUtilGetIpv6AddrInfo (char * ifname, ipv6_addr_info_t ** pp_info, int * p
}
}

fclose(fp);
return 0;
}

Expand Down
3 changes: 3 additions & 0 deletions source/platform/linux/he_bus/src/he_bus_connection.c
Original file line number Diff line number Diff line change
Expand Up @@ -437,6 +437,9 @@ int process_recv_unicast_connected_clients_data(he_bus_handle_t handle, hash_map
he_bus_connection_info_t *temp_client = hash_map_remove(client_info_map,
key);
if (temp_client != NULL) {
if (temp_client->fd != SOCKET_INVALID_FD) {
close(temp_client->fd);
}
he_bus_free(temp_client);
Comment thread
navyasher marked this conversation as resolved.
}
continue;
Expand Down
13 changes: 10 additions & 3 deletions source/services/mesh/wifi_service_mesh.c
Original file line number Diff line number Diff line change
Expand Up @@ -1142,10 +1142,17 @@ int process_ext_scan_results(wifi_service_node_t *node, wifi_core_data_t *data)
scan_list = ext->candidates_list.scan_list;
ext->candidates_list.scan_count = num;
} else if (num) {
ext->candidates_list.scan_list = (bss_candidate_t *) realloc(ext->candidates_list.scan_list,
bss_candidate_t *tmp = (bss_candidate_t *) realloc(ext->candidates_list.scan_list,
((num + ext->candidates_list.scan_count) * sizeof(bss_candidate_t)));
Comment thread
navyasher marked this conversation as resolved.
scan_list = ext->candidates_list.scan_list + ext->candidates_list.scan_count;
ext->candidates_list.scan_count += num;
if (tmp == NULL) {
wifi_util_error_print(WIFI_SERVICES, "%s:%d: realloc failed\n", __func__, __LINE__);
return 0;
}
else {
ext->candidates_list.scan_list = tmp;
scan_list = ext->candidates_list.scan_list + ext->candidates_list.scan_count;
ext->candidates_list.scan_count += num;
}
}

for (i = 0; i < num; i++) {
Expand Down
1 change: 1 addition & 0 deletions source/stats/wifi_associated_devices_msmt.c
Original file line number Diff line number Diff line change
Expand Up @@ -585,6 +585,7 @@ void upload_associated_devices_msmt_data(bssid_data_t *bssid_info, sta_data_t *s

//Free up memory
avro_value_decref(&adr);
avro_value_iface_decref(iface);
avro_writer_free(writer);

size += MAGIC_NUMBER_SIZE + SCHEMA_ID_LENGTH;
Expand Down
28 changes: 0 additions & 28 deletions source/webconfig/wifi_encoder.c
Original file line number Diff line number Diff line change
Expand Up @@ -2749,17 +2749,11 @@ webconfig_error_t encode_radio_channel_radio_params(wifi_provider_response_t *ch

radio_chan_data_t *chan_data = chan_stats->stat_pointer;

radio_stats_obj = cJSON_CreateObject();
if (radio_stats_obj == NULL) {
wifi_util_error_print(WIFI_WEBCONFIG, "%s:%d json object creation failed\n", __func__, __LINE__);
return webconfig_error_encode;
}

for (unsigned int count = 0; count < chan_stats->stat_array_size; count++) {
radio_stats_obj = cJSON_CreateObject();
if (radio_stats_obj == NULL) {
wifi_util_error_print(WIFI_WEBCONFIG, "%s:%d: json create object failed\n", __func__, __LINE__);
cJSON_Delete(radio_stats_obj);
return webconfig_error_encode;
}
cJSON_AddItemToArray(radio_stats, radio_stats_obj);
Expand All @@ -2784,17 +2778,11 @@ webconfig_error_t encode_neighbor_radio_params(wifi_provider_response_t *neigh_s
cJSON *neighbor_stats_obj;
wifi_neighbor_ap2_t *neighbor_data = neigh_stats->stat_pointer;

neighbor_stats_obj = cJSON_CreateObject();
if (neighbor_stats_obj == NULL) {
wifi_util_error_print(WIFI_WEBCONFIG, "%s:%d json object creation failed\n", __func__, __LINE__);
return webconfig_error_encode;
}

for (unsigned int count = 0; count < neigh_stats->stat_array_size; count++) {
neighbor_stats_obj = cJSON_CreateObject();
if (neighbor_stats_obj == NULL) {
wifi_util_error_print(WIFI_WEBCONFIG, "%s:%d: json create object failed\n", __func__, __LINE__);
cJSON_Delete(neighbor_stats_obj);
return webconfig_error_encode;
}
cJSON_AddItemToArray(neigh_stats_obj, neighbor_stats_obj);
Expand Down Expand Up @@ -2895,17 +2883,11 @@ webconfig_error_t encode_assocdevice_params(wifi_provider_response_t *assoc_dev_
cJSON *client_stats_obj;
sta_data_t *client_stats = assoc_dev_stats->stat_pointer;

client_stats_obj = cJSON_CreateObject();
if (client_stats_obj == NULL) {
wifi_util_error_print(WIFI_WEBCONFIG, "%s:%d json object creation failed\n", __func__, __LINE__);
return webconfig_error_encode;
}

for (unsigned int count = 0; count < assoc_dev_stats->stat_array_size; count++) {
client_stats_obj = cJSON_CreateObject();
if (client_stats_obj == NULL) {
wifi_util_error_print(WIFI_WEBCONFIG, "%s:%d json object creation failed\n", __func__, __LINE__);
cJSON_Delete(client_stats_obj);
return webconfig_error_encode;
}

Expand Down Expand Up @@ -2954,11 +2936,6 @@ webconfig_error_t encode_radiodiag_params(wifi_provider_response_t *radiodiag_st
cJSON *diag_obj;
radio_data_t *diag_stats = radiodiag_stats->stat_pointer;

diag_obj = cJSON_CreateObject();
if (diag_obj == NULL) {
wifi_util_error_print(WIFI_WEBCONFIG, "%s:%d json object creation failed\n", __func__, __LINE__);
return webconfig_error_encode;
}

for (unsigned int count = 0; count < radiodiag_stats->stat_array_size; count++) {
diag_obj = cJSON_CreateObject();
Expand Down Expand Up @@ -3066,11 +3043,6 @@ webconfig_error_t encode_radio_temperature_params(wifi_provider_response_t *radi
cJSON *temp_obj;
radio_data_t *temp_stats = radiotemperature_stats->stat_pointer;

temp_obj = cJSON_CreateObject();
if (temp_obj == NULL) {
wifi_util_error_print(WIFI_WEBCONFIG, "%s:%d json object creation failed\n", __func__, __LINE__);
return webconfig_error_encode;
}

for (unsigned int count = 0; count < radiotemperature_stats->stat_array_size; count++) {
temp_obj = cJSON_CreateObject();
Expand Down
Loading