mac80211: allocate and fill tidstats only when needed

This fixes memory leaks in the case where we just have the
station info on the stack for internal usage without sending
it to cfg80211.

Fixes: 8689c051a2 ("cfg80211: dynamically allocate per-tid stats for station info")
Signed-off-by: Johannes Berg <johannes.berg@intel.com>
This commit is contained in:
Johannes Berg
2018-05-18 11:40:44 +02:00
parent 39c1134c66
commit 0fdf1493b4
4 changed files with 10 additions and 8 deletions

View File

@@ -108,7 +108,7 @@ static void ieee80211_get_stats(struct net_device *dev,
goto do_survey;
memset(&sinfo, 0, sizeof(sinfo));
sta_set_sinfo(sta, &sinfo);
sta_set_sinfo(sta, &sinfo, false);
i = 0;
ADD_STA_STATS(sta);
@@ -135,7 +135,7 @@ static void ieee80211_get_stats(struct net_device *dev,
continue;
memset(&sinfo, 0, sizeof(sinfo));
sta_set_sinfo(sta, &sinfo);
sta_set_sinfo(sta, &sinfo, false);
i = 0;
ADD_STA_STATS(sta);
}