interface: fix return code of __interface_add()
authorHans Dedecker <dedeckeh@gmail.com>
Mon, 26 Nov 2018 12:55:53 +0000 (13:55 +0100)
committerHans Dedecker <dedeckeh@gmail.com>
Mon, 26 Nov 2018 13:13:33 +0000 (14:13 +0100)
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>
interface.c

index 44f7a874e3033044e2e199ce3a533ba72fce8f76..b21d2345bfc9577884e76aaf006dcdb39e330d5b 100644 (file)
@@ -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;