mirror of
https://git.proxmox.com/git/mirror_frr
synced 2025-08-07 12:44:55 +00:00
lib: move at_close call in vty_stdio to end
Since the at_close call for the stdio vty might exit() the process, move it to the end of the function, after freeing all memory. Signed-off-by: David Lamparter <equinox@opensourcerouting.org>
This commit is contained in:
parent
bff9c3e9d3
commit
dd03f8cae1
@ -2227,6 +2227,7 @@ void
|
|||||||
vty_close (struct vty *vty)
|
vty_close (struct vty *vty)
|
||||||
{
|
{
|
||||||
int i;
|
int i;
|
||||||
|
bool was_stdio;
|
||||||
|
|
||||||
/* Cancel threads.*/
|
/* Cancel threads.*/
|
||||||
if (vty->t_read)
|
if (vty->t_read)
|
||||||
@ -2254,7 +2255,7 @@ vty_close (struct vty *vty)
|
|||||||
if (vty->fd > 0)
|
if (vty->fd > 0)
|
||||||
close (vty->fd);
|
close (vty->fd);
|
||||||
else
|
else
|
||||||
vty_stdio_reset ();
|
was_stdio = true;
|
||||||
|
|
||||||
if (vty->buf)
|
if (vty->buf)
|
||||||
XFREE (MTYPE_VTY, vty->buf);
|
XFREE (MTYPE_VTY, vty->buf);
|
||||||
@ -2267,6 +2268,9 @@ vty_close (struct vty *vty)
|
|||||||
|
|
||||||
/* OK free vty. */
|
/* OK free vty. */
|
||||||
XFREE (MTYPE_VTY, vty);
|
XFREE (MTYPE_VTY, vty);
|
||||||
|
|
||||||
|
if (was_stdio)
|
||||||
|
vty_stdio_reset ();
|
||||||
}
|
}
|
||||||
|
|
||||||
/* When time out occur output message then close connection. */
|
/* When time out occur output message then close connection. */
|
||||||
|
Loading…
Reference in New Issue
Block a user