summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorStefan Weil2015-04-01 18:57:29 +0200
committerPeter Maydell2015-04-01 18:57:29 +0200
commit60ff4e63e2ea4738f114cbaf1f17e6e0184fc09c (patch)
tree518a45ba779a1069dac8c6e7c08e50de6838b5bb
parentMerge remote-tracking branch 'remotes/bonzini/tags/for-upstream' into staging (diff)
downloadqemu-60ff4e63e2ea4738f114cbaf1f17e6e0184fc09c.tar.gz
qemu-60ff4e63e2ea4738f114cbaf1f17e6e0184fc09c.tar.xz
qemu-60ff4e63e2ea4738f114cbaf1f17e6e0184fc09c.zip
hw/arm/highbank: Fix resource leak and wrong image loading
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> Message-id: 1426326781-2488-1-git-send-email-sw@weilnetz.de Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
-rw-r--r--hw/arm/highbank.c3
1 files changed, 1 insertions, 2 deletions
diff --git a/hw/arm/highbank.c b/hw/arm/highbank.c
index ddd10dc26f..07cb4e057b 100644
--- a/hw/arm/highbank.c
+++ b/hw/arm/highbank.c
@@ -278,8 +278,7 @@ 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);