]> git.ipfire.org Git - thirdparty/hostap.git/commitdiff
nl80211: Put nl_cb in error paths
authorBenjamin Berg <benjamin.berg@intel.com>
Thu, 30 Oct 2025 08:24:33 +0000 (09:24 +0100)
committerJouni Malinen <j@w1.fi>
Sat, 13 Dec 2025 19:46:12 +0000 (21:46 +0200)
The newly allocated nl_cb object needs to be freed if there is an error.

Fixes: e32ad281ca39 ("nl80211: Register for Beacon frames in AP mode")
Signed-off-by: Benjamin Berg <benjamin.berg@intel.com>
src/drivers/driver_nl80211.c

index 998ade6fe99d587790962762d95ab3550c2bf11e..24516637ee15d2ec4c43d684f35023fe7ed0ff54 100644 (file)
@@ -1084,12 +1084,14 @@ nl80211_get_wiphy_data_ap(struct i802_bss *bss)
                w->nl_beacons = nl_create_handle(bss->drv->global->nl_cb,
                                                 "wiphy beacons");
                if (w->nl_beacons == NULL) {
+                       nl_cb_put(w->nl_cb);
                        os_free(w);
                        return NULL;
                }
 
                if (nl80211_register_beacons(bss->drv, w)) {
                        nl_destroy_handles(&w->nl_beacons);
+                       nl_cb_put(w->nl_cb);
                        os_free(w);
                        return NULL;
                }