rsi: Fix a potential memory leak in rsi_send_auto_rate_request()
authorChristian Engelmayer <cengelma@gmx.at>
Thu, 10 Apr 2014 18:37:53 +0000 (20:37 +0200)
committerJohn W. Linville <linville@tuxdriver.com>
Mon, 14 Apr 2014 18:31:42 +0000 (14:31 -0400)
Fix a potential memory leak in the error path of function
rsi_send_auto_rate_request(). In case memory allocation for array
'selected_rates' fails, the error path exits and leaves the previously
allocated skb in place. Detected by Coverity: CID 1195575.

Signed-off-by: Christian Engelmayer <cengelma@gmx.at>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
drivers/net/wireless/rsi/rsi_91x_mgmt.c

index 3a030b9d0fe6c48b9db3fc6a946bf1ccf56e428b..1b28cda6ca88124deff6c112a060f5af6692cefa 100644 (file)
@@ -966,6 +966,7 @@ static int rsi_send_auto_rate_request(struct rsi_common *common)
        if (!selected_rates) {
                rsi_dbg(ERR_ZONE, "%s: Failed in allocation of mem\n",
                        __func__);
+               dev_kfree_skb(skb);
                return -ENOMEM;
        }