rtlwifi: rtl8192de: Fix leak in _rtl92de_read_adapter_info()
authorChristian Engelmayer <cengelma@gmx.at>
Tue, 9 Aug 2016 19:19:57 +0000 (21:19 +0200)
committerKalle Valo <kvalo@codeaurora.org>
Sat, 3 Sep 2016 16:52:25 +0000 (19:52 +0300)
In case rtl_get_hwinfo() fails, the function directly returns and leaks the
already allocated hwinfo memory. Go through the correct exit path.

Signed-off-by: Christian Engelmayer <cengelma@gmx.at>
Acked-by: Larry Finger <Larry.Finger@lwfinger.net>
Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
drivers/net/wireless/realtek/rtlwifi/rtl8192de/hw.c

index b0f63246233538577251d22fa65fa0c75dca3944..57205514801c2bce0ee0871e5a505e1867d702a0 100644 (file)
@@ -1757,7 +1757,7 @@ static void _rtl92de_read_adapter_info(struct ieee80211_hw *hw)
                return;
 
        if (rtl_get_hwinfo(hw, rtlpriv, HWSET_MAX_SIZE, hwinfo, params))
-               return;
+               goto exit;
 
        _rtl92de_efuse_update_chip_version(hw);
        _rtl92de_read_macphymode_and_bandtype(hw, hwinfo);
@@ -1790,6 +1790,7 @@ static void _rtl92de_read_adapter_info(struct ieee80211_hw *hw)
                break;
        }
        rtlefuse->txpwr_fromeprom = true;
+exit:
        kfree(hwinfo);
 }