contrib/hostapd/hostapd/hostapd.c
static void hostapd_cleanup(struct hostapd_data *hapd)
{
	hostapd_ctrl_iface_deinit(hapd);

	os_free(hapd->default_wep_key);
	hapd->default_wep_key = NULL;
	iapp_deinit(hapd->iapp);
	hapd->iapp = NULL;
	accounting_deinit(hapd);
	rsn_preauth_iface_deinit(hapd);
	if (hapd->wpa_auth) {
		wpa_deinit(hapd->wpa_auth);
		hapd->wpa_auth = NULL;

		if (hostapd_set_privacy(hapd, 0)) {
			wpa_printf(MSG_DEBUG, "Could not disable "
				   "PrivacyInvoked for interface %s",
				   hapd->conf->iface);
		}

		if (hostapd_set_generic_elem(hapd, (u8 *) "", 0)) {
			wpa_printf(MSG_DEBUG, "Could not remove generic "
				   "information element from interface %s",
				   hapd->conf->iface);
		}
	}
	ieee802_1x_deinit(hapd);
	vlan_deinit(hapd);
	hostapd_acl_deinit(hapd);
	radius_client_deinit(hapd->radius);
	hapd->radius = NULL;
	radius_server_deinit(hapd->radius_srv);
	hapd->radius_srv = NULL;

#ifdef CONFIG_IEEE80211R
	l2_packet_deinit(hapd->l2);
#endif /* CONFIG_IEEE80211R */

	hostapd_deinit_wps(hapd);

	hostapd_wireless_event_deinit(hapd);

#ifdef EAP_TLS_FUNCS
	if (hapd->ssl_ctx) {
		tls_deinit(hapd->ssl_ctx);
		hapd->ssl_ctx = NULL;
	}
#endif /* EAP_TLS_FUNCS */

#ifdef EAP_SERVER
	if (hapd->eap_sim_db_priv) {
		eap_sim_db_deinit(hapd->eap_sim_db_priv);
		hapd->eap_sim_db_priv = NULL;
	}
#endif /* EAP_SERVER */

	if (hapd->interface_added &&
	    hostapd_bss_remove(hapd, hapd->conf->iface)) {
		wpa_printf(MSG_WARNING, "Failed to remove BSS interface %s",
			   hapd->conf->iface);
	}
}
/**
 * hostapd_cleanup - Per-BSS cleanup (deinitialization)
 * @hapd: Pointer to BSS data
 *
 * This function is used to free all per-BSS data structures and resources.
 * This gets called in a loop for each BSS between calls to
 * hostapd_cleanup_iface_pre() and hostapd_cleanup_iface() when an interface
 * is deinitialized. Most of the modules that are initialized in
 * hostapd_setup_bss() are deinitialized here.
 */
Per-BSS cleanup (deinitialization)
@hapd: Pointer to BSS data

This function is used to free all per-BSS data structures and resources.
This gets called in a loop for each BSS between calls to
hostapd_cleanup_iface_pre() and hostapd_cleanup_iface() when an interface
is deinitialized. Most of the modules that are initialized in
hostapd_setup_bss() are deinitialized here.
Per - BSS cleanup ( deinitialization ) @hapd : Pointer to BSS data This function is used to free all per - BSS data structures and resources . This gets called in a loop for each BSS between calls to hostapd_cleanup_iface_pre () and hostapd_cleanup_iface () when an interface is deinitialized . Most of the modules that are initialized in hostapd_setup_bss () are deinitialized here .
static void hostapd_cleanup(struct hostapd_data *hapd)
{
	hostapd_ctrl_iface_deinit(hapd);
	os_free(hapd->default_wep_key);
	hapd->default_wep_key = NULL;
	iapp_deinit(hapd->iapp);
	hapd->iapp = NULL;
	accounting_deinit(hapd);
	rsn_preauth_iface_deinit(hapd);
	if (hapd->wpa_auth) {
		wpa_deinit(hapd->wpa_auth);
		hapd->wpa_auth = NULL;
		if (hostapd_set_privacy(hapd, 0)) {
			wpa_printf(MSG_DEBUG, "Could not disable "
				   "PrivacyInvoked for interface %s",
				   hapd->conf->iface);
		}
		if (hostapd_set_generic_elem(hapd, (u8 *) "", 0)) {
			wpa_printf(MSG_DEBUG, "Could not remove generic "
				   "information element from interface %s",
				   hapd->conf->iface);
		}
	}
	ieee802_1x_deinit(hapd);
	vlan_deinit(hapd);
	hostapd_acl_deinit(hapd);
	radius_client_deinit(hapd->radius);
	hapd->radius = NULL;
	radius_server_deinit(hapd->radius_srv);
	hapd->radius_srv = NULL;
#ifdef CONFIG_IEEE80211R
	l2_packet_deinit(hapd->l2);
#endif 
	hostapd_deinit_wps(hapd);
	hostapd_wireless_event_deinit(hapd);
#ifdef EAP_TLS_FUNCS
	if (hapd->ssl_ctx) {
		tls_deinit(hapd->ssl_ctx);
		hapd->ssl_ctx = NULL;
	}
#endif 
#ifdef EAP_SERVER
	if (hapd->eap_sim_db_priv) {
		eap_sim_db_deinit(hapd->eap_sim_db_priv);
		hapd->eap_sim_db_priv = NULL;
	}
#endif 
	if (hapd->interface_added &&
	    hostapd_bss_remove(hapd, hapd->conf->iface)) {
		wpa_printf(MSG_WARNING, "Failed to remove BSS interface %s",
			   hapd->conf->iface);
	}
}
static void hostapd_cleanup ( struct hostapd_data * hapd ) { hostapd_ctrl_iface_deinit ( hapd ) ; os_free ( hapd -> default_wep_key ) ; hapd -> default_wep_key = NULL ; iapp_deinit ( hapd -> iapp ) ; hapd -> iapp = NULL ; accounting_deinit ( hapd ) ; rsn_preauth_iface_deinit ( hapd ) ; if ( hapd -> wpa_auth ) { wpa_deinit ( hapd -> wpa_auth ) ; hapd -> wpa_auth = NULL ; if ( hostapd_set_privacy ( hapd , 0 ) ) { wpa_printf ( MSG_DEBUG , " " " " , hapd -> conf -> iface ) ; } if ( hostapd_set_generic_elem ( hapd , ( u8 * ) " " , 0 ) ) { wpa_printf ( MSG_DEBUG , " " " " , hapd -> conf -> iface ) ; } } ieee802_1x_deinit ( hapd ) ; vlan_deinit ( hapd ) ; hostapd_acl_deinit ( hapd ) ; radius_client_deinit ( hapd -> radius ) ; hapd -> radius = NULL ; radius_server_deinit ( hapd -> radius_srv ) ; hapd -> radius_srv = NULL ; #ifdef CONFIG_IEEE80211R l2_packet_deinit ( hapd -> l2 ) ; #endif hostapd_deinit_wps ( hapd ) ; hostapd_wireless_event_deinit ( hapd ) ; #ifdef EAP_TLS_FUNCS if ( hapd -> ssl_ctx ) { tls_deinit ( hapd -> ssl_ctx ) ; hapd -> ssl_ctx = NULL ; } #endif #ifdef EAP_SERVER if ( hapd -> eap_sim_db_priv ) { eap_sim_db_deinit ( hapd -> eap_sim_db_priv ) ; hapd -> eap_sim_db_priv = NULL ; } #endif if ( hapd -> interface_added && hostapd_bss_remove ( hapd , hapd -> conf -> iface ) ) { wpa_printf ( MSG_WARNING , " " , hapd -> conf -> iface ) ; } }
hostapd_cleanup - Per-BSS cleanup (deinitialization)
 @hapd: Pointer to BSS data
hostapd_cleanup - Per - BSS cleanup ( deinitialization ) @hapd : Pointer to BSS data
/* CONFIG_IEEE80211R */ /* EAP_TLS_FUNCS */ /* EAP_SERVER */