aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorEugene A. Shatokhin <dame_eugene@mail.ru>2011-06-28 23:04:51 -0400
committerGreg Kroah-Hartman <gregkh@suse.de>2011-07-13 05:29:24 +0200
commit6d40246c4ed85bcc88f195cbc5c613673a73306a (patch)
tree52108e6d6b6b461d1f11688e1f3829f110faffaa
parent1588e8230601e70f79743755c2e031392e6a9a53 (diff)
ath5k: fix memory leak when fewer than N_PD_CURVES are in use
commit a0b8de350be458b33248e48b2174d9af8a4c4798 upstream. We would free the proper number of curves, but in the wrong slots, due to a missing level of indirection through the pdgain_idx table. It's simpler just to try to free all four slots, so do that. Signed-off-by: Bob Copeland <me@bobcopeland.com> Signed-off-by: John W. Linville <linville@tuxdriver.com> Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
-rw-r--r--drivers/net/wireless/ath/ath5k/eeprom.c8
1 files changed, 3 insertions, 5 deletions
diff --git a/drivers/net/wireless/ath/ath5k/eeprom.c b/drivers/net/wireless/ath/ath5k/eeprom.c
index 9a96550006ad..caed62b0f35b 100644
--- a/drivers/net/wireless/ath/ath5k/eeprom.c
+++ b/drivers/net/wireless/ath/ath5k/eeprom.c
@@ -1588,14 +1588,12 @@ ath5k_eeprom_free_pcal_info(struct ath5k_hw *ah, int mode)
if (!chinfo[pier].pd_curves)
continue;
- for (pdg = 0; pdg < ee->ee_pd_gains[mode]; pdg++) {
+ for (pdg = 0; pdg < AR5K_EEPROM_N_PD_CURVES; pdg++) {
struct ath5k_pdgain_info *pd =
&chinfo[pier].pd_curves[pdg];
- if (pd != NULL) {
- kfree(pd->pd_step);
- kfree(pd->pd_pwr);
- }
+ kfree(pd->pd_step);
+ kfree(pd->pd_pwr);
}
kfree(chinfo[pier].pd_curves);