From: Thomas Graf Date: Tue, 5 Feb 2013 12:52:22 +0000 (+0100) Subject: link: Free and realloc af specific data upon rtnl_link_set_family() X-Git-Tag: libnl3_2_22rc1~44 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=8026fe2e3a9089eff3f5a06ee6e3cc78d96334ed;p=libnl link: Free and realloc af specific data upon rtnl_link_set_family() Signed-off-by: Thomas Graf --- diff --git a/lib/route/link.c b/lib/route/link.c index 99c5013..7450545 100644 --- a/lib/route/link.c +++ b/lib/route/link.c @@ -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); } /**