iwlwifi: mvm: Free fw_status after use to avoid memory leak
authorHaim Dreyfuss <haim.dreyfuss@intel.com>
Wed, 20 May 2015 05:10:43 +0000 (08:10 +0300)
committerEmmanuel Grumbach <emmanuel.grumbach@intel.com>
Thu, 21 May 2015 19:26:59 +0000 (22:26 +0300)
fw_status is the only pointer pointing to a block of memory
allocated above and should be freed after use.
Note: this come from Klockwork static analyzer.

Cc: stable@vger.kernel.org [3.19+]
Fixes: 2021a89d7b8a ("iwlwifi: mvm: treat netdetect wake up separately")
Signed-off-by: Haim Dreyfuss <haim.dreyfuss@intel.com>
Signed-off-by: Emmanuel Grumbach <emmanuel.grumbach@intel.com>
drivers/net/wireless/iwlwifi/mvm/d3.c

index 1b1b2bf26819be1d09903f3c52957d274ee50ed7..42dadaf5e24d527f15b2f01aeedeb314eead5978 100644 (file)
@@ -1750,8 +1750,10 @@ static void iwl_mvm_query_netdetect_reasons(struct iwl_mvm *mvm,
        int i, j, n_matches, ret;
 
        fw_status = iwl_mvm_get_wakeup_status(mvm, vif);
-       if (!IS_ERR_OR_NULL(fw_status))
+       if (!IS_ERR_OR_NULL(fw_status)) {
                reasons = le32_to_cpu(fw_status->wakeup_reasons);
+               kfree(fw_status);
+       }
 
        if (reasons & IWL_WOWLAN_WAKEUP_BY_RFKILL_DEASSERTED)
                wakeup.rfkill_release = true;