nl80211: Memory leak fixed
authorNiko Jokinen <ext-niko.k.jokinen@nokia.com>
Wed, 15 Jul 2009 08:00:53 +0000 (11:00 +0300)
committerJohn W. Linville <linville@tuxdriver.com>
Tue, 21 Jul 2009 16:07:42 +0000 (12:07 -0400)
Potential memory leak via msg pointer in nl80211_get_key() function.

Signed-off-by: Niko Jokinen <ext-niko.k.jokinen@nokia.com>
Signed-off-by: Luciano Coelho <luciano.coelho@nokia.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
net/wireless/nl80211.c

index 43bdb1372caee29772f63397dd7ce1f7e7edd963..634496b3ed77cb7adf5e1ec1356a307b6b897356 100644 (file)
@@ -997,7 +997,7 @@ static int nl80211_get_key(struct sk_buff *skb, struct genl_info *info)
 
        if (IS_ERR(hdr)) {
                err = PTR_ERR(hdr);
-               goto out;
+               goto free_msg;
        }
 
        cookie.msg = msg;
@@ -1011,7 +1011,7 @@ static int nl80211_get_key(struct sk_buff *skb, struct genl_info *info)
                                &cookie, get_key_callback);
 
        if (err)
-               goto out;
+               goto free_msg;
 
        if (cookie.error)
                goto nla_put_failure;
@@ -1022,6 +1022,7 @@ static int nl80211_get_key(struct sk_buff *skb, struct genl_info *info)
 
  nla_put_failure:
        err = -ENOBUFS;
+ free_msg:
        nlmsg_free(msg);
  out:
        cfg80211_put_dev(drv);