]> git.ipfire.org Git - thirdparty/hostap.git/commitdiff
ACS: Fix memory leak if interface is disabled during scan
authorJouni Malinen <j@w1.fi>
Sat, 4 Mar 2017 11:48:29 +0000 (13:48 +0200)
committerJouni Malinen <j@w1.fi>
Sat, 4 Mar 2017 15:30:15 +0000 (17:30 +0200)
The survey data was not freed if hostapd interface got disabled during
an ACS scan.

Signed-off-by: Jouni Malinen <j@w1.fi>
src/ap/acs.c
src/ap/acs.h
src/ap/hostapd.c

index 0cef2bff537a1f57c6b5f2036b4804697b8421d7..aa59058946b5d92cb1e75e22c8d89118a6afc515 100644 (file)
@@ -260,7 +260,7 @@ static void acs_clean_chan_surveys(struct hostapd_channel_data *chan)
 }
 
 
-static void acs_cleanup(struct hostapd_iface *iface)
+void acs_cleanup(struct hostapd_iface *iface)
 {
        int i;
        struct hostapd_channel_data *chan;
index fc85259e85d53416772fcba17975d2709b2caa56..ec84f0ee97f34d501069f171e3494833be6af884 100644 (file)
@@ -13,6 +13,7 @@
 #ifdef CONFIG_ACS
 
 enum hostapd_chan_status acs_init(struct hostapd_iface *iface);
+void acs_cleanup(struct hostapd_iface *iface);
 
 #else /* CONFIG_ACS */
 
@@ -22,6 +23,10 @@ static inline enum hostapd_chan_status acs_init(struct hostapd_iface *iface)
        return HOSTAPD_CHAN_INVALID;
 }
 
+static inline void acs_cleanup(struct hostapd_iface *iface)
+{
+}
+
 #endif /* CONFIG_ACS */
 
 #endif /* ACS_H */
index 4ae7520b210c56616a968f827a25671c5040887d..21023dd8bb2fb8a7d463e18c3df7829ad4a298bc 100644 (file)
@@ -46,6 +46,7 @@
 #include "neighbor_db.h"
 #include "rrm.h"
 #include "fils_hlp.h"
+#include "acs.h"
 
 
 static int hostapd_flush_old_stations(struct hostapd_data *hapd, u16 reason);
@@ -394,8 +395,11 @@ static void hostapd_cleanup_iface_partial(struct hostapd_iface *iface)
        hostapd_stop_setup_timers(iface);
 #endif /* NEED_AP_MLME */
 #endif /* CONFIG_IEEE80211N */
+       if (iface->current_mode)
+               acs_cleanup(iface);
        hostapd_free_hw_features(iface->hw_features, iface->num_hw_features);
        iface->hw_features = NULL;
+       iface->current_mode = NULL;
        os_free(iface->current_rates);
        iface->current_rates = NULL;
        os_free(iface->basic_rates);