From 0a6ffdf029f502610cc1f950d2f80d573f7563c2 Mon Sep 17 00:00:00 2001 From: Denis Kenzior Date: Tue, 23 Aug 2016 13:15:00 -0500 Subject: [PATCH] netdev: Fix double-free We should only call eapol_cancel if netdev_connect_free was not triggered as a result of handshake failure. --- src/netdev.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/src/netdev.c b/src/netdev.c index 0a9fcbec..a398c8df 100644 --- a/src/netdev.c +++ b/src/netdev.c @@ -276,8 +276,10 @@ static void netdev_connect_free(struct netdev *netdev) netdev->eapol_io = NULL; } - netdev->eapol_active = false; - eapol_cancel(netdev->index); + if (netdev->eapol_active) { + eapol_cancel(netdev->index); + netdev->eapol_active = false; + } netdev->connected = false; netdev->connect_cb = NULL;