[PATCH 3/4] bobject: free object name in bobject_del()

Sascha Hauer s.hauer at pengutronix.de
Mon Nov 10 05:48:36 PST 2025


On Fri, Nov 07, 2025 at 01:00:53PM +0100, Sascha Hauer wrote:
> We have bobject_free() which removes all parameters and frees the
> bobject. This works for bobjects which have been allocated with
> bobject_alloc(). struct device has a bobject embedded and is freed
> along with the device, so bobject_free() is inappropriate and
> bobject_del() is called instead. This however doesn't free the bobjects
> name which then leaks when the device is freed.
> 
> To fix this move the freeing of the bobject name to bobject_del(). To
> make this work with CONFIG_PARAMETER disabled drop the static inline
> wrapper.

With this we have to drop the freeing of struct device::name in
free_device_res() as the name is now owned by the bobject.

Fixed up accordingly while applying.

Sascha

-- 
Pengutronix e.K.                           |                             |
Steuerwalder Str. 21                       | http://www.pengutronix.de/  |
31137 Hildesheim, Germany                  | Phone: +49-5121-206917-0    |
Amtsgericht Hildesheim, HRA 2686           | Fax:   +49-5121-206917-5555 |



More information about the barebox mailing list