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

Reply via email to