[PATCH] dfu: memory leak in dfu_free_entities()

Heinrich Schuchardt xypron.glpk at gmx.de
Thu Mar 18 12:52:19 CET 2021


On 18.03.21 12:18, Heinrich Schuchardt wrote:
> We must free all entries that we remove from the list not just one to avoid
> a memory leak.
>
> With list_for_each_entry_safe_reverse() it is safe to delete the current
> entry as it provides a second pointer for the next entry.

I got that wrong:

dfu_alt_init() reserves memory for dfu_alt_num entries at once.
So must call free() only once.

Sorry for the noise.

Best regards

Heinrich


More information about the U-Boot mailing list