summaryrefslogtreecommitdiff
path: root/lib/vty.c
diff options
context:
space:
mode:
authorQuentin Young <qlyoung@users.noreply.github.com>2018-07-03 17:38:09 -0400
committerGitHub <noreply@github.com>2018-07-03 17:38:09 -0400
commit4adc8f685251713b272cf1968b08acbb76196f7d (patch)
treedbdbcd3f4cccac2f9331e1526f39338ef7f569a6 /lib/vty.c
parent94adf8d33e5d229282f9eb71b01f8c82abbdd24d (diff)
parentb575a12c878f5fc0c346204215f648e112f026e0 (diff)
Merge pull request #2620 from pacovn/PVS-Studio_null_check_2
bgpd lib ospfd pimd ripngd: null chk (PVS-Studio)
Diffstat (limited to 'lib/vty.c')
-rw-r--r--lib/vty.c16
1 files changed, 9 insertions, 7 deletions
diff --git a/lib/vty.c b/lib/vty.c
index e9d1f2e323..073092dfb6 100644
--- a/lib/vty.c
+++ b/lib/vty.c
@@ -479,6 +479,8 @@ static int vty_command(struct vty *vty, char *buf)
const char *protocolname;
char *cp = NULL;
+ assert(vty);
+
/*
* Log non empty command lines
*/
@@ -496,13 +498,13 @@ static int vty_command(struct vty *vty, char *buf)
/* format the base vty info */
snprintf(vty_str, sizeof(vty_str), "vty[??]@%s", vty->address);
- if (vty)
- for (i = 0; i < vector_active(vtyvec); i++)
- if (vty == vector_slot(vtyvec, i)) {
- snprintf(vty_str, sizeof(vty_str),
- "vty[%d]@%s", i, vty->address);
- break;
- }
+
+ for (i = 0; i < vector_active(vtyvec); i++)
+ if (vty == vector_slot(vtyvec, i)) {
+ snprintf(vty_str, sizeof(vty_str), "vty[%d]@%s",
+ i, vty->address);
+ break;
+ }
/* format the prompt */
snprintf(prompt_str, sizeof(prompt_str), cmd_prompt(vty->node),