On Tue, 7 Jul 2020 at 19:31, Philippe Mathieu-Daudé <f4...@amsat.org> wrote:
>
> Add avr_load_firmware() function to load firmware in ELF or
> raw binary format.

Hi; Coverity points out a memory leak (CID 1430449) in this function:

> +bool avr_load_firmware(AVRCPU *cpu, MachineState *ms,
> +                       MemoryRegion *program_mr, const char *firmware)
> +{
> +    const char *filename;
> +    int bytes_loaded;
> +    uint64_t entry;
> +    uint32_t e_flags;
> +
> +    filename = qemu_find_file(QEMU_FILE_TYPE_BIOS, firmware);

qemu_find_file() allocates and returns memory, but we don't
pass this to any function that takes ownership of it,
and none of the exit paths from the function (either error-exit
or success-exit cases) call g_free() on it.

thanks
-- PMM

Reply via email to