Commit 525e0da7 authored by Dong Anyuan's avatar Dong Anyuan

Fix Coverity Scan CID 300379 (Variable csi_reports going out of scope leaks...

Fix Coverity Scan CID 300379 (Variable csi_reports going out of scope leaks the storage it points to.)
parent fdb47bed
...@@ -192,8 +192,14 @@ int flexran_agent_mac_stats_reply(mid_t mod_id, ...@@ -192,8 +192,14 @@ int flexran_agent_mac_stats_reply(mid_t mod_id,
for (j = 0; j < dl_report->n_csi_report; j++) { for (j = 0; j < dl_report->n_csi_report; j++) {
csi_reports[j] = malloc(sizeof(Protocol__FlexDlCsi)); csi_reports[j] = malloc(sizeof(Protocol__FlexDlCsi));
if (csi_reports[j] == NULL) if (csi_reports[j] == NULL) {
for (k = 0; k < j; k++) {
free(csi_reports[k]);
}
free(csi_reports);
csi_reports = NULL;
goto error; goto error;
}
protocol__flex_dl_csi__init(csi_reports[j]); protocol__flex_dl_csi__init(csi_reports[j]);
//The servCellIndex for this report //The servCellIndex for this report
csi_reports[j]->serv_cell_index = j; csi_reports[j]->serv_cell_index = j;
...@@ -213,8 +219,14 @@ int flexran_agent_mac_stats_reply(mid_t mod_id, ...@@ -213,8 +219,14 @@ int flexran_agent_mac_stats_reply(mid_t mod_id,
Protocol__FlexCsiP10 *csi10; Protocol__FlexCsiP10 *csi10;
csi10 = malloc(sizeof(Protocol__FlexCsiP10)); csi10 = malloc(sizeof(Protocol__FlexCsiP10));
if (csi10 == NULL) if (csi10 == NULL) {
for (k = 0; k <= j; k++) {
free(csi_reports[k]);
}
free(csi_reports);
csi_reports = NULL;
goto error; goto error;
}
protocol__flex_csi_p10__init(csi10); protocol__flex_csi_p10__init(csi10);
//TODO: set the wideband value //TODO: set the wideband value
// NN: this is also depends on cc_id // NN: this is also depends on cc_id
...@@ -229,8 +241,14 @@ int flexran_agent_mac_stats_reply(mid_t mod_id, ...@@ -229,8 +241,14 @@ int flexran_agent_mac_stats_reply(mid_t mod_id,
Protocol__FlexCsiP11 *csi11; Protocol__FlexCsiP11 *csi11;
csi11 = malloc(sizeof(Protocol__FlexCsiP11)); csi11 = malloc(sizeof(Protocol__FlexCsiP11));
if (csi11 == NULL) if (csi11 == NULL) {
for (k = 0; k <= j; k++) {
free(csi_reports[k]);
}
free(csi_reports);
csi_reports = NULL;
goto error; goto error;
}
protocol__flex_csi_p11__init(csi11); protocol__flex_csi_p11__init(csi11);
csi11->wb_cqi = malloc(sizeof(csi11->wb_cqi)); csi11->wb_cqi = malloc(sizeof(csi11->wb_cqi));
...@@ -274,8 +292,14 @@ int flexran_agent_mac_stats_reply(mid_t mod_id, ...@@ -274,8 +292,14 @@ int flexran_agent_mac_stats_reply(mid_t mod_id,
Protocol__FlexCsiP20 *csi20; Protocol__FlexCsiP20 *csi20;
csi20 = malloc(sizeof(Protocol__FlexCsiP20)); csi20 = malloc(sizeof(Protocol__FlexCsiP20));
if (csi20 == NULL) if (csi20 == NULL) {
for (k = 0; k <= j; k++) {
free(csi_reports[k]);
}
free(csi_reports);
csi_reports = NULL;
goto error; goto error;
}
protocol__flex_csi_p20__init(csi20); protocol__flex_csi_p20__init(csi20);
csi20->wb_cqi = flexran_get_ue_wcqi (enb_id, UE_id); csi20->wb_cqi = flexran_get_ue_wcqi (enb_id, UE_id);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment