summaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorHans Dedecker <dedeckeh@gmail.com>2018-11-26 13:55:53 +0100
committerHans Dedecker <dedeckeh@gmail.com>2018-11-26 14:13:33 +0100
commitdfa4ede4e3b2fd0f50b14fcb2dd141cd73a5c74f (patch)
tree4a3fd7870e8b03bb061608f412fc48c00476fdeb
parenta82a8f65e6e6caf0a4059f4258cccca0895becbf (diff)
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 <dedeckeh@gmail.com>
-rw-r--r--interface.c6
1 files 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;