hostapd: get reference to object before removal
authorMatthew Cather <[email protected]>
Mon, 3 Mar 2025 21:46:03 +0000 (15:46 -0600)
committerFelix Fietkau <[email protected]>
Wed, 5 Mar 2025 07:04:52 +0000 (08:04 +0100)
commit634ac2bab7c4bd70f8497b4847d30f12b520ec3f
tree3402ed03b15cddf2f8c0ab066512fc741564908f
parent1af7bf38f7e78becefc0b5af503bde735c58f767
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 <[email protected]>
(cherry picked from commit 6a10da2934441a59283394a84917edf4983e3043)
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