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,
for (j = 0; j < dl_report->n_csi_report; j++) {
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;
}
protocol__flex_dl_csi__init(csi_reports[j]);
//The servCellIndex for this report
csi_reports[j]->serv_cell_index = j;
......@@ -213,8 +219,14 @@ int flexran_agent_mac_stats_reply(mid_t mod_id,
Protocol__FlexCsiP10 *csi10;
csi10 = malloc(sizeof(Protocol__FlexCsiP10));
if (csi10 == NULL)
goto error;
if (csi10 == NULL) {
for (k = 0; k <= j; k++) {
free(csi_reports[k]);
}
free(csi_reports);
csi_reports = NULL;
goto error;
}
protocol__flex_csi_p10__init(csi10);
//TODO: set the wideband value
// NN: this is also depends on cc_id
......@@ -229,8 +241,14 @@ int flexran_agent_mac_stats_reply(mid_t mod_id,
Protocol__FlexCsiP11 *csi11;
csi11 = malloc(sizeof(Protocol__FlexCsiP11));
if (csi11 == NULL)
goto error;
if (csi11 == NULL) {
for (k = 0; k <= j; k++) {
free(csi_reports[k]);
}
free(csi_reports);
csi_reports = NULL;
goto error;
}
protocol__flex_csi_p11__init(csi11);
csi11->wb_cqi = malloc(sizeof(csi11->wb_cqi));
......@@ -274,8 +292,14 @@ int flexran_agent_mac_stats_reply(mid_t mod_id,
Protocol__FlexCsiP20 *csi20;
csi20 = malloc(sizeof(Protocol__FlexCsiP20));
if (csi20 == NULL)
goto error;
if (csi20 == NULL) {
for (k = 0; k <= j; k++) {
free(csi_reports[k]);
}
free(csi_reports);
csi_reports = NULL;
goto error;
}
protocol__flex_csi_p20__init(csi20);
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