]> granicus.if.org Git - libnl/commitdiff
link: Fix af_ops leak on ENOMEM
authorThomas Graf <tgraf@suug.ch>
Tue, 5 Feb 2013 12:03:02 +0000 (13:03 +0100)
committerThomas Graf <tgraf@suug.ch>
Tue, 5 Feb 2013 12:03:02 +0000 (13:03 +0100)
Signed-off-by: Thomas Graf <tgraf@suug.ch>
lib/route/link.c

index 8b5227ed15439d2f54b8e3091128aa2f60002ad3..e395529dcc808e2c1a53502c4863bffc6b929f9f 100644 (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;
 }