Fix Coverity Scan CID 300412 (Variable macstats going out of scope leaks the storage it points to.)

This commit is contained in:
Dong Anyuan
2019-05-28 22:16:38 +09:00
parent 1f752815cf
commit 4f55adf6e2
@@ -598,8 +598,10 @@ int flexran_agent_mac_stats_reply(mid_t mod_id,
Protocol__FlexMacSdusDl ** mac_sdus;
mac_sdus = malloc(sizeof(Protocol__FlexMacSdusDl) * flexran_get_num_mac_sdu_tx(mod_id, UE_id, cc_id));
if (mac_sdus == NULL)
if (mac_sdus == NULL) {
free(macstats);
goto error;
}
macstats->n_mac_sdus_dl = flexran_get_num_mac_sdu_tx(mod_id, UE_id, cc_id);