]> git.proxmox.com Git - mirror_frr.git/blobdiff - vtysh/vtysh_main.c
doc: Add `show ipv6 rpf X:X::X:X` command to docs
[mirror_frr.git] / vtysh / vtysh_main.c
index ca119eb9004155fdc4dc45c0d984b7ddcafcc749..be7eb3ecdfd666860a76220aacf84f7bd7597f6b 100644 (file)
@@ -111,6 +111,8 @@ static void vtysh_rl_callback(char *line_read)
 
        if (!vtysh_loop_exited)
                rl_callback_handler_install(vtysh_prompt(), vtysh_rl_callback);
+
+       free(line_read);
 }
 
 /* SIGTSTP handler.  This function care user's ^Z input. */
@@ -352,6 +354,7 @@ int main(int argc, char **argv, char **env)
        const char *pathspace_arg = NULL;
        char pathspace[MAXPATHLEN] = "";
        const char *histfile = NULL;
+       const char *histfile_env = getenv("VTYSH_HISTFILE");
 
        /* SUID: drop down to calling user & go back up when needed */
        elevuid = geteuid();
@@ -609,10 +612,8 @@ int main(int argc, char **argv, char **env)
         * VTYSH_HISTFILE is preferred over command line
         * argument (-H/--histfile).
         */
-       if (getenv("VTYSH_HISTFILE")) {
-               const char *file = getenv("VTYSH_HISTFILE");
-
-               strlcpy(history_file, file, sizeof(history_file));
+       if (histfile_env) {
+               strlcpy(history_file, histfile_env, sizeof(history_file));
        } else if (histfile) {
                strlcpy(history_file, histfile, sizeof(history_file));
        } else {