mirror of https://gerrit.osmocom.org/libosmocore
vty: Attempt to fix various meam leaks in the VTY lookup code
These routines were not freeing vectors used for the lookup. On review it is fixing another path not detected by coverity. The danger is a double free in tab completion now. It is difficult to test this. Fixes: Coverity CID 23037, CID 23038
This commit is contained in:
parent
cd252e3565
commit
047213b01e
|
@ -1574,10 +1574,12 @@ cmd_describe_command_real(vector vline, struct vty *vty, int *status)
|
|||
if ((ret = is_cmd_ambiguous(command, cmd_vector, i,
|
||||
match)) == 1) {
|
||||
vector_free(cmd_vector);
|
||||
vector_free(matchvec);
|
||||
*status = CMD_ERR_AMBIGUOUS;
|
||||
return NULL;
|
||||
} else if (ret == 2) {
|
||||
vector_free(cmd_vector);
|
||||
vector_free(matchvec);
|
||||
*status = CMD_ERR_NO_MATCH;
|
||||
return NULL;
|
||||
}
|
||||
|
@ -1724,6 +1726,7 @@ static char **cmd_complete_command_real(vector vline, struct vty *vty,
|
|||
|
||||
if (vector_active(vline) == 0) {
|
||||
*status = CMD_ERR_NO_MATCH;
|
||||
vector_free(cmd_vector);
|
||||
return NULL;
|
||||
} else
|
||||
index = vector_active(vline) - 1;
|
||||
|
|
Loading…
Reference in New Issue