* [Qemu-devel] [PATCH] hw/arm/vexpress: Fix memory leak reported by Coverity
@ 2015-03-14 10:59 Stefan Weil
2015-03-15 2:33 ` Eric Blake
0 siblings, 1 reply; 5+ messages in thread
From: Stefan Weil @ 2015-03-14 10:59 UTC (permalink / raw)
To: QEMU Developer; +Cc: Peter Maydell, Stefan Weil
As the conditional statement had to be splitted anyway, we can also
add a better error report message.
Signed-off-by: Stefan Weil <sw@weilnetz.de>
---
hw/arm/vexpress.c | 13 ++++++++++---
1 file changed, 10 insertions(+), 3 deletions(-)
diff --git a/hw/arm/vexpress.c b/hw/arm/vexpress.c
index 8496c16..54dd967 100644
--- a/hw/arm/vexpress.c
+++ b/hw/arm/vexpress.c
@@ -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);
}
--
1.7.10.4
^ permalink raw reply related [flat|nested] 5+ messages in thread
* Re: [Qemu-devel] [PATCH] hw/arm/vexpress: Fix memory leak reported by Coverity
2015-03-14 10:59 [Qemu-devel] [PATCH] hw/arm/vexpress: Fix memory leak reported by Coverity Stefan Weil
@ 2015-03-15 2:33 ` Eric Blake
2015-03-20 18:58 ` Stefan Weil
0 siblings, 1 reply; 5+ messages in thread
From: Eric Blake @ 2015-03-15 2:33 UTC (permalink / raw)
To: Stefan Weil, QEMU Developer; +Cc: Peter Maydell
[-- Attachment #1: Type: text/plain, Size: 537 bytes --]
On 03/14/2015 04:59 AM, Stefan Weil wrote:
> 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)
> add a better error report message.
>
> Signed-off-by: Stefan Weil <sw@weilnetz.de>
> ---
> hw/arm/vexpress.c | 13 ++++++++++---
> 1 file changed, 10 insertions(+), 3 deletions(-)
--
Eric Blake eblake redhat com +1-919-301-3266
Libvirt virtualization library http://libvirt.org
[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 604 bytes --]
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [Qemu-devel] [PATCH] hw/arm/vexpress: Fix memory leak reported by Coverity
2015-03-15 2:33 ` Eric Blake
@ 2015-03-20 18:58 ` Stefan Weil
0 siblings, 0 replies; 5+ messages in thread
From: Stefan Weil @ 2015-03-20 18:58 UTC (permalink / raw)
To: Eric Blake, QEMU Developer; +Cc: Peter Maydell
Am 15.03.2015 um 03:33 schrieb Eric Blake:
> On 03/14/2015 04:59 AM, Stefan Weil wrote:
>> 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).
^ permalink raw reply [flat|nested] 5+ messages in thread
* [Qemu-devel] [PATCH] hw/arm/vexpress: Fix memory leak reported by Coverity
@ 2015-03-14 11:50 Stefan Weil
2015-03-20 18:57 ` Stefan Weil
0 siblings, 1 reply; 5+ messages in thread
From: Stefan Weil @ 2015-03-14 11:50 UTC (permalink / raw)
To: QEMU Developer; +Cc: Peter Maydell, Stefan Weil
As the conditional statement had to be splitted anyway, we can also
add a better error report message.
Signed-off-by: Stefan Weil <sw@weilnetz.de>
---
hw/arm/virt.c | 11 +++++++++--
1 file changed, 9 insertions(+), 2 deletions(-)
diff --git a/hw/arm/virt.c b/hw/arm/virt.c
index 9072bc2..87b50e3 100644
--- a/hw/arm/virt.c
+++ b/hw/arm/virt.c
@@ -552,7 +552,8 @@ static void create_flash(const VirtBoardInfo *vbi)
char *nodename;
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 "
@@ -561,7 +562,13 @@ static void create_flash(const VirtBoardInfo *vbi)
exit(1);
}
fn = qemu_find_file(QEMU_FILE_TYPE_BIOS, bios_name);
- if (!fn || load_image_targphys(fn, flashbase, flashsize) < 0) {
+ if (!fn) {
+ error_report("Could not find ROM image '%s'", bios_name);
+ exit(1);
+ }
+ image_size = load_image_targphys(fn, flashbase, flashsize);
+ g_free(fn);
+ if (image_size < 0) {
error_report("Could not load ROM image '%s'", bios_name);
exit(1);
}
--
1.7.10.4
^ permalink raw reply related [flat|nested] 5+ messages in thread
* Re: [Qemu-devel] [PATCH] hw/arm/vexpress: Fix memory leak reported by Coverity
2015-03-14 11:50 Stefan Weil
@ 2015-03-20 18:57 ` Stefan Weil
0 siblings, 0 replies; 5+ messages in thread
From: Stefan Weil @ 2015-03-20 18:57 UTC (permalink / raw)
To: QEMU Developer; +Cc: Peter Maydell
Am 14.03.2015 um 12:50 schrieb Stefan Weil:
> As the conditional statement had to be splitted anyway, we can also
> add a better error report message.
>
> Signed-off-by: Stefan Weil <sw@weilnetz.de>
> ---
> hw/arm/virt.c | 11 +++++++++--
> 1 file changed, 9 insertions(+), 2 deletions(-)
>
>
Superseded by new patch v2.
^ permalink raw reply [flat|nested] 5+ messages in thread
end of thread, other threads:[~2015-03-20 18:58 UTC | newest]
Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2015-03-14 10:59 [Qemu-devel] [PATCH] hw/arm/vexpress: Fix memory leak reported by Coverity Stefan Weil
2015-03-15 2:33 ` Eric Blake
2015-03-20 18:58 ` Stefan Weil
-- strict thread matches above, loose matches on Subject: below --
2015-03-14 11:50 Stefan Weil
2015-03-20 18:57 ` Stefan Weil
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).