On Fri, 10 Oct 2025 at 13:09, Peter Maydell <[email protected]> wrote: > > On Fri, 10 Oct 2025 at 12:53, Alex Bennée <[email protected]> wrote: > > > > Peter Maydell <[email protected]> writes: > > > > > On Wed, 8 Oct 2025 at 20:17, Daan De Meyer <[email protected]> > > > wrote: > > >> + } else { > > >> + fprintf(stderr, > > >> + "unable to handle EFI zboot image with \"%.*s\" > > >> compression\n", > > >> + (int)sizeof(header->compression_type) - 1, > > >> + header->compression_type); > > >> + return -1; > > > > > > Moving the "unrecognized compression type" error path down to > > > here means that we have moved it below the g_malloc() of the > > > data buffer, so we now need to g_free() to avoid a leak. > > > > Could we not declare: > > > > g_autofree uint8_t *data = NULL; > > > > and drop the cleanup? > > You could, if you wanted to, convert the file to g_autofree, yes.
Whoops -- I meant "convert the function" here; I wasn't trying to suggest doing the whole file (which is probably a bad idea). -- PMM
