diff options
| author | Donald Sharp <sharpd@cumulusnetworks.com> | 2017-02-08 13:44:53 -0500 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2017-02-08 13:44:53 -0500 |
| commit | 10c7cd3920b0105a009dae138a481f56473bc463 (patch) | |
| tree | 061c082c167150c7b24d1a16021efc2abc31fcab /lib/command.c | |
| parent | e6b737294a80af25060216cbf91b13f2c3a617b4 (diff) | |
| parent | 8ac885457f9a16032fcc157488c0b0ea48a686c1 (diff) | |
Merge pull request #185 from opensourcerouting/coverity-lib-1
Coverity foo
Diffstat (limited to 'lib/command.c')
| -rw-r--r-- | lib/command.c | 25 |
1 files changed, 4 insertions, 21 deletions
diff --git a/lib/command.c b/lib/command.c index 510699f91b..6467fb7185 100644 --- a/lib/command.c +++ b/lib/command.c @@ -294,27 +294,6 @@ cmd_free_strvec (vector v) vector_free (v); } -char * -cmd_concat_strvec (vector v) -{ - size_t strsize = 0; - for (unsigned int i = 0; i < vector_active (v); i++) - if (vector_slot (v, i)) - strsize += strlen ((char *) vector_slot (v, i)) + 1; - - if (strsize == 0) - return XSTRDUP (MTYPE_TMP, ""); - - char *concatenated = calloc (sizeof (char), strsize); - for (unsigned int i = 0; i < vector_active (v); i++) - { - strlcat (concatenated, (char *) vector_slot (v, i), strsize); - strlcat (concatenated, " ", strsize); - } - - return concatenated; -} - /* Return prompt character of specified node. */ const char * cmd_prompt (enum node_type node) @@ -720,6 +699,8 @@ cmd_complete_command (vector vline, struct vty *vty, int *status) vector_free (comps); comps = NULL; } + else if (initial_comps) + vector_free (initial_comps); // comps should always be null here assert (!comps); @@ -805,6 +786,8 @@ cmd_execute_command_real (vector vline, // if matcher error, return corresponding CMD_ERR if (MATCHER_ERROR(status)) { + if (argv_list) + list_delete (argv_list); switch (status) { case MATCHER_INCOMPLETE: |
