From 9320658c0d448fd6d90f2b438d0cc60d9a2765d4 Mon Sep 17 00:00:00 2001 From: Quentin Young Date: Thu, 2 Nov 2017 11:50:13 -0400 Subject: [PATCH] vtysh: protect null deref for cli completions cmd_describe_command() returns NULL when there is no matched command, so check the return value before trying to free it Signed-off-by: Quentin Young --- vtysh/vtysh.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/vtysh/vtysh.c b/vtysh/vtysh.c index 72a15f24dd..6fdd7167ce 100644 --- a/vtysh/vtysh.c +++ b/vtysh/vtysh.c @@ -820,7 +820,8 @@ static int vtysh_rl_describe(void) break; case CMD_ERR_NO_MATCH: cmd_free_strvec(vline); - vector_free(describe); + if (describe) + vector_free(describe); fprintf(stdout, "%% There is no matched command.\n"); rl_on_new_line(); return 0; -- 2.39.5