diff --git a/lib/vty.c b/lib/vty.c index 2d8112727a..280b2ace51 100644 --- a/lib/vty.c +++ b/lib/vty.c @@ -120,9 +120,11 @@ bool vty_set_include(struct vty *vty, const char *regexp) bool ret = true; char errbuf[256]; - if (!regexp && vty->filter) { - regfree(&vty->include); - vty->filter = false; + if (!regexp) { + if (vty->filter) { + regfree(&vty->include); + vty->filter = false; + } return true; }