diff options
author | Quentin Young <qlyoung@cumulusnetworks.com> | 2016-11-12 02:06:32 +0100 |
---|---|---|
committer | Quentin Young <qlyoung@cumulusnetworks.com> | 2016-11-12 02:06:32 +0100 |
commit | 17aca20bfbb9d7e980a04c9b017f87f027901839 (patch) | |
tree | 86e31be2464ae41c3125400a161b87d34419d098 /lib/command_parse.y | |
parent | lib: Allow '-' to match VARIABLE_TKN (diff) | |
download | frr-17aca20bfbb9d7e980a04c9b017f87f027901839.tar.xz frr-17aca20bfbb9d7e980a04c9b017f87f027901839.zip |
lib, vtysh: Fix memory leaks, change cmd_element to const
Fix a few memory issues:
* Not freeing tab-completions upon input match failure
* Invalid write when null-terminating tab-completions
* Not freeing argv[] itself in additinon to elements
* Use XFREE() instead of free() as appropriate
* Not freeing final token of an [option] during parsing
Make a few minor changes to CLI internals:
* Improve documentation on matching & completion functions
* Only make one copy of cmd_token's when building argv,
instead of three
* Don't make a copy of the matching cmd_element
Make one major(ish) change to CLI internals:
* Change all pointers to struct cmd_element to const
Code outside of the core CLI units should never have an
occasion to modify the internal state of the command system.
Doing so could easily amount to having a CLI interface that
changes during runtime, and could conceivably lead to security
issues. Explicitly disallowing this removes any chance of
confusion.
Signed-off-by: Quentin Young <qlyoung@cumulusnetworks.com>
Diffstat (limited to 'lib/command_parse.y')
-rw-r--r-- | lib/command_parse.y | 1 |
1 files changed, 1 insertions, 0 deletions
diff --git a/lib/command_parse.y b/lib/command_parse.y index 3ef0b42eb..6348643b8 100644 --- a/lib/command_parse.y +++ b/lib/command_parse.y @@ -383,6 +383,7 @@ option_token_seq: $$->start = $1->start; $$->end = $2->end; free ($1); + free ($2); } ; |