[PATCH v5 09/10] tools: spkgimage: add Renesas SPKG format

Ralph Siemsen ralph.siemsen at linaro.org
Tue May 9 15:07:16 CEST 2023


On Tue, May 09, 2023 at 04:25:06AM +0200, Marek Vasut wrote:
>
>The usual fail path handling like:
>
>"
>if (there is an error)
>  goto exit;
>...
>
>exit:
> free(data);
> return ret;
>"
>
>does not work here ?

Yes, this would handle de-allocation in the failing case.

However in the normal case (no error), there is no corresponding call to 
free(). And there is no good place to put such a call, given the API of 
the callbacks. It would be possible call free() from print_header, 
however this is brittle since it relies on mkimage core calling 
print_header as the last step (and only once).

Ralph


More information about the U-Boot mailing list