eiwd

no dbus iwd with iwctl functionality
git clone https://git.daat.foo/repos/eiwd.git
Log | Files | Refs | Submodules | README | LICENSE

commit 716e3f0cdaa45cc57e8104cef0080e4a3c46483f
parent 875c6f27e75984f3ea541b9f2defa5b6b8220870
Author: Denis Kenzior <denkenz@gmail.com>
Date:   Mon,  8 Apr 2019 16:24:18 -0500

eap: Add eap_free_common

Many operations performed during an error in load_settings were the same
as the ones performed when freeing the eap object.  Add eap_free_common
to unify these.

Diffstat:
Msrc/eap.c | 17+++++++++++------
1 file changed, 11 insertions(+), 6 deletions(-)

diff --git a/src/eap.c b/src/eap.c @@ -110,14 +110,22 @@ bool eap_reset(struct eap_state *eap) return true; } -void eap_free(struct eap_state *eap) +static void eap_free_common(struct eap_state *eap) { if (eap->method_state && eap->method->free) eap->method->free(eap); - if (eap->identity) + eap->method = NULL; + + if (eap->identity) { l_free(eap->identity); + eap->identity = NULL; + } +} +void eap_free(struct eap_state *eap) +{ + eap_free_common(eap); l_timeout_remove(eap->complete_timeout); l_free(eap); @@ -562,10 +570,7 @@ bool eap_load_settings(struct eap_state *eap, struct l_settings *settings, return true; err: - if (eap->method_state && eap->method->free) - eap->method->free(eap); - - eap->method = NULL; + eap_free_common(eap); return false; }