From dfa4ede4e3b2fd0f50b14fcb2dd141cd73a5c74f Mon Sep 17 00:00:00 2001 From: Hans Dedecker Date: Mon, 26 Nov 2018 13:55:53 +0100 Subject: [PATCH] interface: fix return code of __interface_add() For dynamic interfaces don't return false if vlist_find returns NULL as the calling function will try to free iface in case of an error which has already been freed in interface_change_config() Signed-off-by: Hans Dedecker --- interface.c | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/interface.c b/interface.c index 44f7a87..b21d234 100644 --- a/interface.c +++ b/interface.c @@ -922,11 +922,9 @@ static bool __interface_add(struct interface *iface, struct blob_attr *config, b iface = vlist_find(&interfaces, name, iface, node); free(name); - if (!iface) - return false; - /* Don't delete dynamic interface on reload */ - iface->node.version = -1; + if (iface) + iface->node.version = -1; } return true; -- 2.25.1