mirror of
https://git.proxmox.com/git/mirror_frr
synced 2025-08-08 07:37:29 +00:00
vtysh: properly fix memory leak
Commit 44f12f20
fixed the memory leak in the wrong way and introduced a
"uninitialized variable" warning.
Signed-off-by: Renato Westphal <renato@opensourcerouting.org>
This commit is contained in:
parent
b5b583aa8d
commit
80c872f699
@ -807,24 +807,26 @@ static int vtysh_rl_describe(void)
|
|||||||
|
|
||||||
fprintf(stdout, "\n");
|
fprintf(stdout, "\n");
|
||||||
|
|
||||||
|
describe = cmd_describe_command(vline, vty, &ret);
|
||||||
|
|
||||||
/* Ambiguous and no match error. */
|
/* Ambiguous and no match error. */
|
||||||
switch (ret) {
|
switch (ret) {
|
||||||
case CMD_ERR_AMBIGUOUS:
|
case CMD_ERR_AMBIGUOUS:
|
||||||
cmd_free_strvec(vline);
|
cmd_free_strvec(vline);
|
||||||
|
vector_free(describe);
|
||||||
fprintf(stdout, "%% Ambiguous command.\n");
|
fprintf(stdout, "%% Ambiguous command.\n");
|
||||||
rl_on_new_line();
|
rl_on_new_line();
|
||||||
return 0;
|
return 0;
|
||||||
break;
|
break;
|
||||||
case CMD_ERR_NO_MATCH:
|
case CMD_ERR_NO_MATCH:
|
||||||
cmd_free_strvec(vline);
|
cmd_free_strvec(vline);
|
||||||
|
vector_free(describe);
|
||||||
fprintf(stdout, "%% There is no matched command.\n");
|
fprintf(stdout, "%% There is no matched command.\n");
|
||||||
rl_on_new_line();
|
rl_on_new_line();
|
||||||
return 0;
|
return 0;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
describe = cmd_describe_command(vline, vty, &ret);
|
|
||||||
|
|
||||||
/* Get width of command string. */
|
/* Get width of command string. */
|
||||||
width = 0;
|
width = 0;
|
||||||
for (i = 0; i < vector_active(describe); i++)
|
for (i = 0; i < vector_active(describe); i++)
|
||||||
|
Loading…
Reference in New Issue
Block a user