* [Qemu-devel] [PATCH] hw/arm/highbank: Fix resource leak and wrong image loading
@ 2015-03-14 9:53 Stefan Weil
0 siblings, 0 replies; only message in thread
From: Stefan Weil @ 2015-03-14 9:53 UTC (permalink / raw)
To: QEMU Developer; +Cc: Rob Herring, Stefan Weil, Peter Maydell
Coverity reports a resource leak for sysboot_filename which is allocated
by qemu_find_file.
In addition, that name is used to get the size of the image, but a
different image name was used to load it.
In addition, instead of passing the maximum allowed image size the actual
image size was passed to load_image_targphys.
Fix all three issues.
Signed-off-by: Stefan Weil <sw@weilnetz.de>
---
hw/arm/highbank.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/hw/arm/highbank.c b/hw/arm/highbank.c
index a92cdc3..07cb4e0 100644
--- a/hw/arm/highbank.c
+++ b/hw/arm/highbank.c
@@ -278,10 +278,10 @@ static void calxeda_init(MachineState *machine, enum cxmachines machine_id)
if (bios_name != NULL) {
sysboot_filename = qemu_find_file(QEMU_FILE_TYPE_BIOS, bios_name);
if (sysboot_filename != NULL) {
- uint32_t filesize = get_image_size(sysboot_filename);
- if (load_image_targphys("sysram.bin", 0xfff88000, filesize) < 0) {
+ if (load_image_targphys(sysboot_filename, 0xfff88000, 0x8000) < 0) {
hw_error("Unable to load %s\n", bios_name);
}
+ g_free(sysboot_filename);
} else {
hw_error("Unable to find %s\n", bios_name);
}
--
1.7.10.4
^ permalink raw reply related [flat|nested] only message in thread
only message in thread, other threads:[~2015-03-14 9:53 UTC | newest]
Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2015-03-14 9:53 [Qemu-devel] [PATCH] hw/arm/highbank: Fix resource leak and wrong image loading 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).