[PATCH v2 1/2] Add new rtnl_link_af_data_compare function to compare af_data

Thomas Graf tgraf at suug.ch
Fri Jan 18 08:39:56 EST 2013


On 01/17/13 at 04:29pm, roopa at cumulusnetworks.com wrote:
> +int rtnl_link_af_data_compare(struct rtnl_link *a, struct rtnl_link *b,
> +			      int family)
> +{
> +	struct rtnl_link_af_ops *af_ops = rtnl_link_af_ops_lookup(family);
> +
> +	if (!af_ops)
> +		return ~0;
> +
> +	if (!a->l_af_data[family] && !b->l_af_data[family])
> +		return 0;
> +
> +	if (!a->l_af_data[family] || !b->l_af_data[family])
> +		return ~0;
> +
> +	if (af_ops->ao_compare)
> +		return af_ops->ao_compare(a, b, family, ~0, 0);
> +
> +	return 0;
> +}

Sorry, I missed this in the first review round. You are leaking
a refcnt of rtnl_link_af_ops above. You need to call
rtnl_link_af_ops_put() and return the reference.



More information about the libnl mailing list