summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPaul Jakma <paul.jakma@sun.com>2006-05-12 23:24:09 +0000
committerPaul Jakma <paul.jakma@sun.com>2006-05-12 23:24:09 +0000
commit5fc60519ede0d34688832e353c35bf1832a4330d (patch)
treee934b6a2730d3dfdc877f097b7c896ec9a97fcf4
parent2fe8aba3a09b3e2a64ee1861d8eeb389efaf1eb0 (diff)
[lib] CID #55, fix return of freed pointer, cmd_describe_command_real
2006-05-12 Paul Jakma <paul.jakma@sun.com> * command.c: (cmd_describe_command_real) Fix return of freed pointer when no-match, CID #55.
-rw-r--r--lib/ChangeLog2
-rw-r--r--lib/command.c6
2 files changed, 5 insertions, 3 deletions
diff --git a/lib/ChangeLog b/lib/ChangeLog
index 46727473..f5cee80b 100644
--- a/lib/ChangeLog
+++ b/lib/ChangeLog
@@ -4,6 +4,8 @@
of prefix and typestr strings, Coverity CID #3.
* command.c: (cmd_complete_command_real) Fix leak of cmd_vector
in error case, Coverity CID #37.
+ (cmd_describe_command_real) Fix return of freed pointer when
+ no-match, CID #55.
* vty.c: (vty_describe_command) fix leak of describe vector in
error path, CID #39.
diff --git a/lib/command.c b/lib/command.c
index 1c277b38..07297eff 100644
--- a/lib/command.c
+++ b/lib/command.c
@@ -1,5 +1,5 @@
/*
- $Id: command.c,v 1.52 2006/05/12 23:19:37 paul Exp $
+ $Id: command.c,v 1.53 2006/05/12 23:24:09 paul Exp $
Command interpreter routine for virtual terminal [aka TeletYpe]
Copyright (C) 1997, 98, 99 Kunihiro Ishiguro
@@ -1693,10 +1693,10 @@ cmd_describe_command_real (vector vline, struct vty *vty, int *status)
{
vector_free (matchvec);
*status = CMD_ERR_NO_MATCH;
+ return NULL;
}
- else
- *status = CMD_SUCCESS;
+ *status = CMD_SUCCESS;
return matchvec;
}