Commit 25ff2b7c authored by Dong Anyuan's avatar Dong Anyuan

Fix Coverity Scan CID 300427 (Variable ue_report going out of scope leaks the...

Fix Coverity Scan CID 300427 (Variable ue_report going out of scope leaks the storage it points to.)
parent adccea21
...@@ -424,7 +424,7 @@ int flexran_agent_stats_reply(mid_t enb_id, xid_t xid, const report_config_t *re ...@@ -424,7 +424,7 @@ int flexran_agent_stats_reply(mid_t enb_id, xid_t xid, const report_config_t *re
Protocol__FlexHeader *header = NULL; Protocol__FlexHeader *header = NULL;
err_code_t err_code = PROTOCOL__FLEXRAN_ERR__UNEXPECTED; err_code_t err_code = PROTOCOL__FLEXRAN_ERR__UNEXPECTED;
int i; int i,j;
if (flexran_create_header(xid, PROTOCOL__FLEX_TYPE__FLPT_STATS_REPLY, &header) != 0) if (flexran_create_header(xid, PROTOCOL__FLEX_TYPE__FLPT_STATS_REPLY, &header) != 0)
goto error; goto error;
...@@ -445,7 +445,7 @@ int flexran_agent_stats_reply(mid_t enb_id, xid_t xid, const report_config_t *re ...@@ -445,7 +445,7 @@ int flexran_agent_stats_reply(mid_t enb_id, xid_t xid, const report_config_t *re
// UE report // UE report
Protocol__FlexUeStatsReport **ue_report; Protocol__FlexUeStatsReport **ue_report = NULL;
ue_report = malloc(sizeof(Protocol__FlexUeStatsReport *) * report_config->nr_ue); ue_report = malloc(sizeof(Protocol__FlexUeStatsReport *) * report_config->nr_ue);
...@@ -471,6 +471,10 @@ int flexran_agent_stats_reply(mid_t enb_id, xid_t xid, const report_config_t *re ...@@ -471,6 +471,10 @@ int flexran_agent_stats_reply(mid_t enb_id, xid_t xid, const report_config_t *re
cell_report = malloc(sizeof(Protocol__FlexCellStatsReport *) * report_config->nr_cc); cell_report = malloc(sizeof(Protocol__FlexCellStatsReport *) * report_config->nr_cc);
if (cell_report == NULL) { if (cell_report == NULL) {
for (j = 0; j < report_config->nr_ue; j++) {
free(ue_report[j]);
}
free(ue_report);
free(stats_reply_msg); free(stats_reply_msg);
goto error; goto error;
} }
...@@ -479,6 +483,10 @@ int flexran_agent_stats_reply(mid_t enb_id, xid_t xid, const report_config_t *re ...@@ -479,6 +483,10 @@ int flexran_agent_stats_reply(mid_t enb_id, xid_t xid, const report_config_t *re
cell_report[i] = malloc(sizeof(Protocol__FlexCellStatsReport)); cell_report[i] = malloc(sizeof(Protocol__FlexCellStatsReport));
if(cell_report[i] == NULL) { if(cell_report[i] == NULL) {
for (j = 0; j < report_config->nr_ue; j++) {
free(ue_report[j]);
}
free(ue_report);
free(stats_reply_msg); free(stats_reply_msg);
goto error; goto error;
} }
...@@ -494,6 +502,10 @@ int flexran_agent_stats_reply(mid_t enb_id, xid_t xid, const report_config_t *re ...@@ -494,6 +502,10 @@ int flexran_agent_stats_reply(mid_t enb_id, xid_t xid, const report_config_t *re
if (flexran_agent_get_mac_xface(enb_id) if (flexran_agent_get_mac_xface(enb_id)
&& flexran_agent_mac_stats_reply(enb_id, report_config, ue_report, cell_report) < 0) { && flexran_agent_mac_stats_reply(enb_id, report_config, ue_report, cell_report) < 0) {
err_code = PROTOCOL__FLEXRAN_ERR__MSG_BUILD; err_code = PROTOCOL__FLEXRAN_ERR__MSG_BUILD;
for (j = 0; j < report_config->nr_ue; j++) {
free(ue_report[j]);
}
free(ue_report);
free(stats_reply_msg); free(stats_reply_msg);
goto error; goto error;
} }
...@@ -502,6 +514,10 @@ int flexran_agent_stats_reply(mid_t enb_id, xid_t xid, const report_config_t *re ...@@ -502,6 +514,10 @@ int flexran_agent_stats_reply(mid_t enb_id, xid_t xid, const report_config_t *re
if (flexran_agent_get_rrc_xface(enb_id) if (flexran_agent_get_rrc_xface(enb_id)
&& flexran_agent_rrc_stats_reply(enb_id, report_config, ue_report, cell_report) < 0) { && flexran_agent_rrc_stats_reply(enb_id, report_config, ue_report, cell_report) < 0) {
err_code = PROTOCOL__FLEXRAN_ERR__MSG_BUILD; err_code = PROTOCOL__FLEXRAN_ERR__MSG_BUILD;
for (j = 0; j < report_config->nr_ue; j++) {
free(ue_report[j]);
}
free(ue_report);
free(stats_reply_msg); free(stats_reply_msg);
goto error; goto error;
} }
...@@ -510,6 +526,10 @@ int flexran_agent_stats_reply(mid_t enb_id, xid_t xid, const report_config_t *re ...@@ -510,6 +526,10 @@ int flexran_agent_stats_reply(mid_t enb_id, xid_t xid, const report_config_t *re
if (flexran_agent_get_pdcp_xface(enb_id) if (flexran_agent_get_pdcp_xface(enb_id)
&& flexran_agent_pdcp_stats_reply(enb_id, report_config, ue_report, cell_report) < 0) { && flexran_agent_pdcp_stats_reply(enb_id, report_config, ue_report, cell_report) < 0) {
err_code = PROTOCOL__FLEXRAN_ERR__MSG_BUILD; err_code = PROTOCOL__FLEXRAN_ERR__MSG_BUILD;
for (j = 0; j < report_config->nr_ue; j++) {
free(ue_report[j]);
}
free(ue_report);
free(stats_reply_msg); free(stats_reply_msg);
goto error; goto error;
} }
...@@ -520,6 +540,10 @@ int flexran_agent_stats_reply(mid_t enb_id, xid_t xid, const report_config_t *re ...@@ -520,6 +540,10 @@ int flexran_agent_stats_reply(mid_t enb_id, xid_t xid, const report_config_t *re
*msg = malloc(sizeof(Protocol__FlexranMessage)); *msg = malloc(sizeof(Protocol__FlexranMessage));
if(*msg == NULL) { if(*msg == NULL) {
for (j = 0; j < report_config->nr_ue; j++) {
free(ue_report[j]);
}
free(ue_report);
free(stats_reply_msg); free(stats_reply_msg);
goto error; goto error;
} }
......
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