link: Fix af_ops leak on ENOMEM

Signed-off-by: Thomas Graf <tgraf@suug.ch>
This commit is contained in:
Thomas Graf 2013-02-05 13:03:02 +01:00
parent 506020ae99
commit 8b8e26b333

View file

@ -72,8 +72,10 @@ static struct rtnl_link_af_ops *af_lookup_and_alloc(struct rtnl_link *link,
if (!af_ops)
return NULL;
if (!(data = rtnl_link_af_alloc(link, af_ops)))
if (!(data = rtnl_link_af_alloc(link, af_ops))) {
rtnl_link_af_ops_put(af_ops);
return NULL;
}
return af_ops;
}