hw/arm/vexpress: Fix memory leak reported by Coverity
PATCH 1/1 hw/arm/vexpress: Fix memory leak reported by Coverity
As the conditional statement had to be splitted anyway, we can also add a better error report message.
Signed-off-by Stefan Weil <[email protected]>
--- hw/arm/vexpress.c | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-)
hw/arm/vexpress.c +10 -3
@@ -562,7 +562,8 @@ static void vexpress_common_init(MachineState *machine)* If a bios file was provided, attempt to map it into memory */ if (bios_name) { -const char *fn; +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 ); }
Signature · 1 line
1.7.10.4
Quoted 1 line · Stefan Weil
As the conditional statement had to be splitted anyway, we can also
s/splitted/split/ (one of those weird English words that has the same spelling for both present and past tenses)
Quoted 6 lines
add a better error report message.
Signed-off-by Stefan Weil <[email protected]>--- hw/arm/vexpress.c | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-)
Signature · 2 lines
Eric Blake eblake redhat com +1-919-301-3266 Libvirt virtualization library http://libvirt.org
Am 15.03.2015 um 03:33 schrieb Eric Blake:
Quoted 4 lines · Stefan Weil
Quoted 1 line
As the conditional statement had to be splitted anyway, we can also
s/splitted/split/ (one of those weird English words that has the same spelling for both present and past tenses)
Thanks. This is fixed in v2 of the patch (going to be sent).