hostapd: get reference to object before removal
authorMatthew Cather <mattbob4@gmail.com>
Mon, 3 Mar 2025 21:46:03 +0000 (15:46 -0600)
committerFelix Fietkau <nbd@nbd.name>
Wed, 5 Mar 2025 07:03:00 +0000 (08:03 +0100)
commit6a10da2934441a59283394a84917edf4983e3043
tree31fe8a2a28b3d05a6590ae747b2d5fe9c9f698bd
parent7729f960933a03c9eebd2b65a695ea57718ccb77
hostapd: get reference to object before removal

`ucv_array_set` releases the array's reference to the object being cleared.
If this is the last reference to the object, it will be freed, making our
pointer `val` invalid.

To avoid this, we need to obtain our own reference to the object so we
can safely return `val`.

Signed-off-by: Matthew Cather <mattbob4@gmail.com>
package/network/services/hostapd/src/src/ap/ucode.c
package/network/services/hostapd/src/src/utils/ucode.c
package/network/services/hostapd/src/wpa_supplicant/ucode.c