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

This commit is contained in:
Dong Anyuan
2019-05-28 21:46:15 +09:00
parent 542bd49c96
commit 5877ee80c7
@@ -409,8 +409,13 @@ int flexran_agent_rrc_stats_reply(mid_t mod_id,
for (int j = 0; j < neigh_meas->n_eutra_meas; j++ ){
eutra_meas[j] = malloc(sizeof(Protocol__FlexEutraMeasurements));
if (eutra_meas[j] == NULL)
if (eutra_meas[j] == NULL) {
for (int k = 0 ; k < j ; k++) {
free(eutra_meas[k]);
}
free(eutra_meas);
goto error;
}
protocol__flex_eutra_measurements__init(eutra_meas[j]);