]> git.proxmox.com Git - mirror_frr.git/blobdiff - vtysh/vtysh.c
lib: clean up tab-completion memory counting
[mirror_frr.git] / vtysh / vtysh.c
index 1db3dca3521a5f1930db857bdb373468176b437b..f15f051e69688cd1f16e09571bd2ab82ccff596d 100644 (file)
@@ -828,8 +828,6 @@ command_generator (const char *text, int state)
       if (rl_end && isspace ((int) rl_line_buffer[rl_end - 1]))
        vector_set (vline, NULL);
 
-      if (matched)
-        XFREE (MTYPE_TMP, matched);
       matched = cmd_complete_command (vline, vty, &complete_status);
       cmd_free_strvec (vline);
     }
@@ -837,6 +835,9 @@ command_generator (const char *text, int state)
   if (matched && matched[index])
     return matched[index++];
 
+  XFREE (MTYPE_TMP, matched);
+  matched = NULL;
+
   return NULL;
 }