Fix Coverity Scan CID 300489 (Variable neigh_meas going out of scope leaks the storage it points to.)
This commit is contained in:
@@ -412,8 +412,10 @@ int flexran_agent_rrc_stats_reply(mid_t mod_id,
|
|||||||
if (neigh_meas->n_eutra_meas > 0){
|
if (neigh_meas->n_eutra_meas > 0){
|
||||||
|
|
||||||
eutra_meas = malloc(sizeof(Protocol__FlexEutraMeasurements) * neigh_meas->n_eutra_meas);
|
eutra_meas = malloc(sizeof(Protocol__FlexEutraMeasurements) * neigh_meas->n_eutra_meas);
|
||||||
if (eutra_meas == NULL)
|
if (eutra_meas == NULL) {
|
||||||
|
free(neigh_meas);
|
||||||
goto error;
|
goto error;
|
||||||
|
}
|
||||||
|
|
||||||
for (int j = 0; j < neigh_meas->n_eutra_meas; j++ ){
|
for (int j = 0; j < neigh_meas->n_eutra_meas; j++ ){
|
||||||
|
|
||||||
@@ -423,6 +425,7 @@ int flexran_agent_rrc_stats_reply(mid_t mod_id,
|
|||||||
free(eutra_meas[k]);
|
free(eutra_meas[k]);
|
||||||
}
|
}
|
||||||
free(eutra_meas);
|
free(eutra_meas);
|
||||||
|
free(neigh_meas);
|
||||||
goto error;
|
goto error;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -453,6 +456,8 @@ int flexran_agent_rrc_stats_reply(mid_t mod_id,
|
|||||||
|
|
||||||
rrc_measurements->neigh_meas = neigh_meas;
|
rrc_measurements->neigh_meas = neigh_meas;
|
||||||
|
|
||||||
|
} else {
|
||||||
|
free(neigh_meas);
|
||||||
}
|
}
|
||||||
|
|
||||||
ue_report[i]->rrc_measurements = rrc_measurements;
|
ue_report[i]->rrc_measurements = rrc_measurements;
|
||||||
|
|||||||
Reference in New Issue
Block a user