summaryrefslogtreecommitdiff
path: root/lib/command.c
diff options
context:
space:
mode:
authorDonald Sharp <sharpd@cumulusnetworks.com>2017-03-09 15:34:57 -0500
committerGitHub <noreply@github.com>2017-03-09 15:34:57 -0500
commita40ccc86afb722a2e841020fcb3439c27088cbba (patch)
tree7bdb18ad510c88b2d958dd41fdfb99cac1562086 /lib/command.c
parent72c62cb803d8b79a2627cd7d8d25a0f801423c49 (diff)
parent6253a46a75442fa5bc3eafb00222d750bcfd7ddd (diff)
Merge pull request #267 from opensourcerouting/vty-completion-again
vty completion memory counting redux
Diffstat (limited to 'lib/command.c')
-rw-r--r--lib/command.c14
1 files changed, 4 insertions, 10 deletions
diff --git a/lib/command.c b/lib/command.c
index 6176640bf6..c9b261cf2a 100644
--- a/lib/command.c
+++ b/lib/command.c
@@ -2445,11 +2445,8 @@ cmd_complete_command_real (vector vline, struct vty *vty, int *status, int islib
/* Only one matched */
if (vector_slot (matchvec, 1) == NULL)
{
- size_t index_size = matchvec->alloced * sizeof (void *);
- match_str = XMALLOC (MTYPE_TMP, index_size);
- memcpy (match_str, matchvec->index, index_size);
- vector_free (matchvec);
-
+ match_str = (char **) matchvec->index;
+ vector_only_wrapper_free (matchvec);
*status = CMD_COMPLETE_FULL_MATCH;
return match_str;
}
@@ -2491,11 +2488,8 @@ cmd_complete_command_real (vector vline, struct vty *vty, int *status, int islib
/* Make new matchvec. */
matchvec = vector_init (INIT_MATCHVEC_SIZE);
vector_set (matchvec, lcdstr);
-
- size_t index_size = matchvec->alloced * sizeof (void *);
- match_str = XMALLOC (MTYPE_TMP, index_size);
- memcpy (match_str, matchvec->index, index_size);
- vector_free (matchvec);
+ match_str = (char **) matchvec->index;
+ vector_only_wrapper_free (matchvec);
*status = CMD_COMPLETE_MATCH;
return match_str;