diff options
authorJouni Malinen <j@w1.fi>2005-12-08 03:15:04 (GMT)
committerJouni Malinen <j@w1.fi>2005-12-08 03:15:04 (GMT)
commitfb606bc07b4d64b245237f2e88478904585a3bdb (patch)
parent92be34b8796b44f0b016306f83d1a45179d20e83 (diff)
Document expected behavior for ctx parameter to eapol_sm_init():
- it must be allocated memory and the caller must not free it (eapol_sm_deinit() will do this) - even though dummy eapol_sm_init() in eapol_sm.h is not really used anymore, better change it to free the buffer just in case to avoid memory leaks should someone start using it without IEEE8021X_EAPOL in the future
2 files changed, 3 insertions, 1 deletions
diff --git a/wpa_supplicant/eapol_sm.c b/wpa_supplicant/eapol_sm.c
index 275415f..49fbe9a 100644
--- a/wpa_supplicant/eapol_sm.c
+++ b/wpa_supplicant/eapol_sm.c
@@ -1667,7 +1667,8 @@ static struct eapol_callbacks eapol_cb =
* eapol_sm_init - Initialize EAPOL state machine
- * @ctx: Pointer to EAPOL context data
+ * @ctx: Pointer to EAPOL context data; this needs to be an allocated buffer
+ * and EAPOL state machine will free it in eapol_sm_deinit()
* Returns: Pointer to the allocated EAPOL state machine or %NULL on failure
* Allocate and initialize an EAPOL state machine.
diff --git a/wpa_supplicant/eapol_sm.h b/wpa_supplicant/eapol_sm.h
index 20da107..1d44a54 100644
--- a/wpa_supplicant/eapol_sm.h
+++ b/wpa_supplicant/eapol_sm.h
@@ -227,6 +227,7 @@ void eapol_sm_notify_lower_layer_success(struct eapol_sm *sm);
#else /* IEEE8021X_EAPOL */
static inline struct eapol_sm *eapol_sm_init(struct eapol_ctx *ctx)
+ free(ctx);
return (struct eapol_sm *) 1;
static inline void eapol_sm_deinit(struct eapol_sm *sm)