diff options
author | Holger Hans Peter Freyther <holger@moiji-mobile.com> | 2013-07-03 09:32:37 +0200 |
---|---|---|
committer | Holger Hans Peter Freyther <holger@moiji-mobile.com> | 2013-07-03 10:00:06 +0200 |
commit | 047213b01e786c9765460fccd5f394e93fc777f1 (patch) | |
tree | 2e0f7831cb428a884084da0e1bbc8151042f09ff /src/vty | |
parent | cd252e356556e28cfc72d66f82fa87d12f3e5a2a (diff) |
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
Diffstat (limited to 'src/vty')
-rw-r--r-- | src/vty/command.c | 3 |
1 files changed, 3 insertions, 0 deletions
diff --git a/src/vty/command.c b/src/vty/command.c index 4f47a6be..faa7c51c 100644 --- a/src/vty/command.c +++ b/src/vty/command.c @@ -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; |