]> git.puffer.fish Git - matthieu/frr.git/commitdiff
vtysh: protect null deref for cli completions
authorQuentin Young <qlyoung@cumulusnetworks.com>
Thu, 2 Nov 2017 15:50:13 +0000 (11:50 -0400)
committerQuentin Young <qlyoung@cumulusnetworks.com>
Thu, 2 Nov 2017 15:53:24 +0000 (11:53 -0400)
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 <qlyoung@cumulusnetworks.com>
vtysh/vtysh.c

index 72a15f24ddb16c1147d147f710e83dcf6cf0820c..6fdd7167ce3d1986f78c15074c390f9a6ae1de8e 100644 (file)
@@ -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;