[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Qemu-devel] [PULL 2/8] hw/arm/vexpress: Fix memory leak reported by Cov
From: |
Peter Maydell |
Subject: |
[Qemu-devel] [PULL 2/8] hw/arm/vexpress: Fix memory leak reported by Coverity |
Date: |
Wed, 1 Apr 2015 18:08:12 +0100 |
From: Stefan Weil <address@hidden>
As the conditional statement had to be split anyway, we can also
add a better error report message.
Signed-off-by: Stefan Weil <address@hidden>
Message-id: address@hidden
Signed-off-by: Peter Maydell <address@hidden>
---
hw/arm/vexpress.c | 11 +++++++++--
1 file changed, 9 insertions(+), 2 deletions(-)
diff --git a/hw/arm/vexpress.c b/hw/arm/vexpress.c
index e9a7ced..dd04527 100644
--- a/hw/arm/vexpress.c
+++ b/hw/arm/vexpress.c
@@ -563,6 +563,7 @@ static void vexpress_common_init(MachineState *machine)
*/
if (bios_name) {
char *fn;
+ int image_size;
if (drive_get(IF_PFLASH, 0, 0)) {
error_report("The contents of the first flash device may be "
@@ -571,8 +572,14 @@ static void vexpress_common_init(MachineState *machine)
exit(1);
}
fn = qemu_find_file(QEMU_FILE_TYPE_BIOS, bios_name);
- if (!fn || load_image_targphys(fn, map[VE_NORFLASH0],
- VEXPRESS_FLASH_SIZE) < 0) {
+ if (!fn) {
+ error_report("Could not find ROM image '%s'", bios_name);
+ exit(1);
+ }
+ image_size = load_image_targphys(fn, map[VE_NORFLASH0],
+ VEXPRESS_FLASH_SIZE);
+ g_free(fn);
+ if (image_size < 0) {
error_report("Could not load ROM image '%s'", bios_name);
exit(1);
}
--
1.9.1
- [Qemu-devel] [PULL 0/8] target-arm queue, Peter Maydell, 2015/04/01
- [Qemu-devel] [PULL 2/8] hw/arm/vexpress: Fix memory leak reported by Coverity,
Peter Maydell <=
- [Qemu-devel] [PULL 8/8] target-arm: kvm64 fix save/restore of SPSR regs, Peter Maydell, 2015/04/01
- [Qemu-devel] [PULL 6/8] hw/intc: arm_gic_kvm.c restore config first, Peter Maydell, 2015/04/01
- [Qemu-devel] [PULL 7/8] target-arm: kvm64 sync FP register state, Peter Maydell, 2015/04/01
- [Qemu-devel] [PULL 4/8] target-arm: Store SPSR_EL1 state in banked_spsr[1] (SPSR_svc), Peter Maydell, 2015/04/01
- [Qemu-devel] [PULL 3/8] hw/arm/virt: Fix memory leak reported by Coverity, Peter Maydell, 2015/04/01
- [Qemu-devel] [PULL 5/8] target-arm: kvm: save/restore mp state, Peter Maydell, 2015/04/01
- [Qemu-devel] [PULL 1/8] hw/arm/highbank: Fix resource leak and wrong image loading, Peter Maydell, 2015/04/01
- Re: [Qemu-devel] [PULL 0/8] target-arm queue, Peter Maydell, 2015/04/01