]> Git Repo - qemu.git/commitdiff
hw/arm/vexpress: Fix memory leak reported by Coverity
authorStefan Weil <[email protected]>
Wed, 1 Apr 2015 16:57:29 +0000 (17:57 +0100)
committerPeter Maydell <[email protected]>
Wed, 1 Apr 2015 16:57:29 +0000 (17:57 +0100)
As the conditional statement had to be split anyway, we can also
add a better error report message.

Signed-off-by: Stefan Weil <[email protected]>
Message-id: 1426877963[email protected]
Signed-off-by: Peter Maydell <[email protected]>
hw/arm/vexpress.c

index e9a7cede6447830f76ade838c8f47fcfb529ee0f..dd045271b8280c3920d1ed6f93f53bea05d53ad0 100644 (file)
@@ -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);
         }
This page took 0.028841 seconds and 4 git commands to generate.