[lib] CID #39, fix leak in error path, vty_describe_command

2006-05-12 Paul Jakma <paul.jakma@sun.com>

	* vty.c: (vty_describe_command) fix leak of describe vector in
	  error path, CID #39.
diff --git a/lib/vty.c b/lib/vty.c
index 206af06..98f6494 100644
--- a/lib/vty.c
+++ b/lib/vty.c
@@ -985,18 +985,12 @@
   switch (ret)
     {
     case CMD_ERR_AMBIGUOUS:
-      cmd_free_strvec (vline);
       vty_out (vty, "%% Ambiguous command.%s", VTY_NEWLINE);
-      vty_prompt (vty);
-      vty_redraw_line (vty);
-      return;
+      goto out;
       break;
     case CMD_ERR_NO_MATCH:
-      cmd_free_strvec (vline);
       vty_out (vty, "%% There is no matched command.%s", VTY_NEWLINE);
-      vty_prompt (vty);
-      vty_redraw_line (vty);
-      return;
+      goto out;
       break;
     }  
 
@@ -1066,6 +1060,7 @@
 	vty_describe_fold (vty, width, desc_width, desc);
     }
 
+out:
   cmd_free_strvec (vline);
   vector_free (describe);