Commit 8eea8a66 authored by Dong Anyuan's avatar Dong Anyuan

Fix Coverity Scan CID 300419 (Variable cell_conf going out of scope leaks the...

Fix Coverity Scan CID 300419 (Variable cell_conf going out of scope leaks the storage it points to.)
parent 94048238
......@@ -746,7 +746,13 @@ int flexran_agent_enb_config_reply(mid_t mod_id, const void *params, Protocol__F
for(int i = 0; i < enb_config_reply_msg->n_cell_config; i++) {
cell_conf[i] = malloc(sizeof(Protocol__FlexCellConfig));
if (!cell_conf[i]) goto error;
if (!cell_conf[i]) {
for (int j = 0; j < i; j++) {
free(cell_conf[j]);
}
free(cell_conf);
goto error;
}
protocol__flex_cell_config__init(cell_conf[i]);
......@@ -768,8 +774,13 @@ int flexran_agent_enb_config_reply(mid_t mod_id, const void *params, Protocol__F
*msg = malloc(sizeof(Protocol__FlexranMessage));
if(*msg == NULL)
if(*msg == NULL) {
for (int k = 0; k < enb_config_reply_msg->n_cell_config; k++) {
free(cell_conf[k]);
}
free(cell_conf);
goto error;
}
protocol__flexran_message__init(*msg);
(*msg)->msg_case = PROTOCOL__FLEXRAN_MESSAGE__MSG_ENB_CONFIG_REPLY_MSG;
......
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