Browse Source

Fix memory leak on rfkill init error path

Jouni Malinen 15 years ago
parent
commit
5216938960
2 changed files with 6 additions and 2 deletions
  1. 3 1
      src/drivers/driver_nl80211.c
  2. 3 1
      src/drivers/driver_wext.c

+ 3 - 1
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;

+ 3 - 1
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;