From 5216938960b8ef9f7c066f4c6afa4b4018c3a348 Mon Sep 17 00:00:00 2001 From: Jouni Malinen Date: Tue, 25 May 2010 12:06:25 +0300 Subject: [PATCH] Fix memory leak on rfkill init error path --- src/drivers/driver_nl80211.c | 4 +++- src/drivers/driver_wext.c | 4 +++- 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/src/drivers/driver_nl80211.c b/src/drivers/driver_nl80211.c index 136ca11c9..2b7462bea 100644 --- a/src/drivers/driver_nl80211.c +++ b/src/drivers/driver_nl80211.c @@ -1426,8 +1426,10 @@ static void * wpa_driver_nl80211_init(void *ctx, const char *ifname) rcfg->blocked_cb = wpa_driver_nl80211_rfkill_blocked; rcfg->unblocked_cb = wpa_driver_nl80211_rfkill_unblocked; drv->rfkill = rfkill_init(rcfg); - if (drv->rfkill == NULL) + if (drv->rfkill == NULL) { wpa_printf(MSG_DEBUG, "nl80211: RFKILL status not available"); + os_free(rcfg); + } if (wpa_driver_nl80211_finish_drv_init(drv)) goto failed; diff --git a/src/drivers/driver_wext.c b/src/drivers/driver_wext.c index ef3a30c3b..222378378 100644 --- a/src/drivers/driver_wext.c +++ b/src/drivers/driver_wext.c @@ -762,8 +762,10 @@ void * wpa_driver_wext_init(void *ctx, const char *ifname) rcfg->blocked_cb = wpa_driver_wext_rfkill_blocked; rcfg->unblocked_cb = wpa_driver_wext_rfkill_unblocked; drv->rfkill = rfkill_init(rcfg); - if (drv->rfkill == NULL) + if (drv->rfkill == NULL) { wpa_printf(MSG_DEBUG, "WEXT: RFKILL status not available"); + os_free(rcfg); + } drv->mlme_sock = -1;