From 8224c6cf9b35ebe2591fab7a72744782109a1380 Mon Sep 17 00:00:00 2001 From: paco Date: Mon, 11 Jun 2018 20:02:58 +0200 Subject: [PATCH] lib: null dereference (Coverity 1469895) Signed-off-by: F. Aragon --- lib/vty.c | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) 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; }