diff options
author | Thomas Graf <tgraf@suug.ch> | 2013-01-18 13:49:08 (GMT) |
---|---|---|
committer | Thomas Graf <tgraf@suug.ch> | 2013-01-18 13:49:33 (GMT) |
commit | 5291af6fb502e1bde7545a6eef261cdf40246110 (patch) | |
tree | 90613a675d739f016a66e882e71c24a055683a08 /lib | |
parent | 5c3f2f015a6ee4cd9cd461a9c2e3054e4a8698ff (diff) | |
download | libnl-5291af6fb502e1bde7545a6eef261cdf40246110.zip libnl-5291af6fb502e1bde7545a6eef261cdf40246110.tar.gz libnl-5291af6fb502e1bde7545a6eef261cdf40246110.tar.bz2 |
link: fix reference leak in rtnl_link_af_data_compare()
Signed-off-by: Thomas Graf <tgraf@suug.ch>
Diffstat (limited to 'lib')
-rw-r--r-- | lib/route/link/api.c | 15 |
1 files changed, 10 insertions, 5 deletions
diff --git a/lib/route/link/api.c b/lib/route/link/api.c index 9387bc5..392ded3 100644 --- a/lib/route/link/api.c +++ b/lib/route/link/api.c @@ -366,20 +366,25 @@ 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); + int ret = 0; if (!af_ops) return ~0; if (!a->l_af_data[family] && !b->l_af_data[family]) - return 0; + goto out; - if (!a->l_af_data[family] || !b->l_af_data[family]) - return ~0; + if (!a->l_af_data[family] || !b->l_af_data[family]) { + ret = ~0; + goto out; + } if (af_ops->ao_compare) - return af_ops->ao_compare(a, b, family, ~0, 0); + ret = af_ops->ao_compare(a, b, family, ~0, 0); +out: + rtnl_link_af_ops_put(af_ops); - return 0; + return ret; } /** @} */ |