]> granicus.if.org Git - libnl/commitdiff
link: Free and realloc af specific data upon rtnl_link_set_family()
authorThomas Graf <tgraf@suug.ch>
Tue, 5 Feb 2013 12:52:22 +0000 (13:52 +0100)
committerThomas Graf <tgraf@suug.ch>
Tue, 5 Feb 2013 12:52:22 +0000 (13:52 +0100)
Signed-off-by: Thomas Graf <tgraf@suug.ch>
lib/route/link.c

index 99c5013b2b26bb18e63e07e23e6154e04b29c421..7450545f9f4d1b07e9fbe14a8f813512d36cff06 100644 (file)
@@ -1742,6 +1742,12 @@ void rtnl_link_set_family(struct rtnl_link *link, int family)
 {
        link->l_family = family;
        link->ce_mask |= LINK_ATTR_FAMILY;
+
+       if (link->l_af_ops)
+               af_free(link, link->l_af_ops,
+                       link->l_af_data[link->l_af_ops->ao_family], NULL);
+
+       link->l_af_ops = af_lookup_and_alloc(link, family);
 }
 
 /**