arm: fix memory leak
authorGonglei <arei.gonglei@huawei.com>
Thu, 5 Mar 2015 02:58:32 +0000 (10:58 +0800)
committerMichael Tokarev <mjt@tls.msk.ru>
Thu, 19 Mar 2015 08:11:55 +0000 (11:11 +0300)
Cc: Michael Tokarev <mjt@tls.msk.ru>
Cc: Peter Maydell <peter.maydell@linaro.org>
Signed-off-by: Gonglei <arei.gonglei@huawei.com>
Signed-off-by: Michael Tokarev <mjt@tls.msk.ru>
hw/arm/digic_boards.c
hw/arm/highbank.c
hw/arm/vexpress.c
hw/arm/virt.c

index 7114c36e3870c2bac2ec02de34df1cc5ad878578..e576646e868b296c69c68b8ee131dc28554a75ea 100644 (file)
@@ -113,6 +113,7 @@ static void digic_load_rom(DigicBoardState *s, hwaddr addr,
             error_report("Couldn't load rom image '%s'.", filename);
             exit(1);
         }
+        g_free(fn);
     }
 }
 
index a92cdc3322c60b805b90a696c2a7481158affa3e..ddd10dc26f6adbf9a1eac61810962a65fa082c0f 100644 (file)
@@ -282,6 +282,7 @@ static void calxeda_init(MachineState *machine, enum cxmachines machine_id)
             if (load_image_targphys("sysram.bin", 0xfff88000, filesize) < 0) {
                 hw_error("Unable to load %s\n", bios_name);
             }
+            g_free(sysboot_filename);
         } else {
            hw_error("Unable to find %s\n", bios_name);
         }
index 8496c1622a90714e8647645efda199be3019ae98..e9a7cede6447830f76ade838c8f47fcfb529ee0f 100644 (file)
@@ -562,7 +562,7 @@ 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;
 
         if (drive_get(IF_PFLASH, 0, 0)) {
             error_report("The contents of the first flash device may be "
@@ -576,6 +576,7 @@ static void vexpress_common_init(MachineState *machine)
             error_report("Could not load ROM image '%s'", bios_name);
             exit(1);
         }
+        g_free(fn);
     }
 
     /* Motherboard peripherals: the wiring is the same but the
index 9072bc2b1cfdae123eea1836fa24099c0cffe910..b2eaea835343c2b4cb85f11274a4bfe2ef7b39a4 100644 (file)
@@ -552,7 +552,7 @@ static void create_flash(const VirtBoardInfo *vbi)
     char *nodename;
 
     if (bios_name) {
-        const char *fn;
+        char *fn;
 
         if (drive_get(IF_PFLASH, 0, 0)) {
             error_report("The contents of the first flash device may be "
@@ -565,6 +565,7 @@ static void create_flash(const VirtBoardInfo *vbi)
             error_report("Could not load ROM image '%s'", bios_name);
             exit(1);
         }
+        g_free(fn);
     }
 
     create_one_flash("virt.flash0", flashbase, flashsize);