summary refs log tree commit diff stats
diff options
context:
space:
mode:
authorMarkus Armbruster <armbru@redhat.com>2012-11-23 19:12:18 +0100
committerStefan Hajnoczi <stefanha@redhat.com>2012-12-07 12:34:12 +0100
commit654598c944aa31cdbea435bd468055af9c918d16 (patch)
tree2480f5186b94f47d1e26f9376964b4ed18806af4
parent3528a3cba1f59de520fad7b1c843759e8655ea2c (diff)
downloadfocaccia-qemu-654598c944aa31cdbea435bd468055af9c918d16.tar.gz
focaccia-qemu-654598c944aa31cdbea435bd468055af9c918d16.zip
pc_sysfw: Plug memory leak on pc_fw_add_pflash_drv() error path
Harmless, because we the error inevitably leads to another, fatal one
in pc_system_flash_init(): PC system firmware (pflash) not available.
Fix it anyway.

Signed-off-by: Markus Armbruster <armbru@redhat.com>
Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
-rw-r--r--hw/pc_sysfw.c4
1 files changed, 3 insertions, 1 deletions
diff --git a/hw/pc_sysfw.c b/hw/pc_sysfw.c
index 9d7c5f4003..40bced2322 100644
--- a/hw/pc_sysfw.c
+++ b/hw/pc_sysfw.c
@@ -98,7 +98,9 @@ static void pc_fw_add_pflash_drv(void)
       return;
     }
 
-    drive_init(opts, machine->use_scsi);
+    if (!drive_init(opts, machine->use_scsi)) {
+        qemu_opts_del(opts);
+    }
 }
 
 static void pc_system_flash_init(MemoryRegion *rom_memory,