From: Quentin Young Date: Thu, 2 Nov 2017 15:50:13 +0000 (-0400) Subject: vtysh: protect null deref for cli completions X-Git-Tag: frr-4.0-dev~173^2 X-Git-Url: https://git.puffer.fish/?a=commitdiff_plain;h=9320658c0d448fd6d90f2b438d0cc60d9a2765d4;p=matthieu%2Ffrr.git 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 --- 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;