Skip to content

Commit 5e29521

Browse files
committed
hw/avr/boot: Fix memory leak in avr_load_firmware()
The value returned by qemu_find_file() must be freed. This fixes Coverity issue CID 1430449, which points out that the memory returned by qemu_find_file() is leaked. Fixes: Coverity CID 1430449 (RESOURCE_LEAK) Fixes: 7dd8f6f ('hw/avr: Add support for loading ELF/raw binaries') Signed-off-by: Philippe Mathieu-Daudé <[email protected]> Reviewed-by: Michael Rolnik <[email protected]> Tested-by: Michael Rolnik <[email protected]> Reviewed-by: Daniel P. Berrangé <[email protected]> Message-Id: <[email protected]>
1 parent b6c61f6 commit 5e29521

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

hw/avr/boot.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,7 @@ static const char *avr_elf_e_flags_to_cpu_type(uint32_t flags)
6060
bool avr_load_firmware(AVRCPU *cpu, MachineState *ms,
6161
MemoryRegion *program_mr, const char *firmware)
6262
{
63-
const char *filename;
63+
g_autofree char *filename = NULL;
6464
int bytes_loaded;
6565
uint64_t entry;
6666
uint32_t e_flags;

0 commit comments

Comments
 (0)