]> xenbits.xensource.com Git - qemu-upstream-4.4-testing.git/commitdiff
pc_sysfw: Plug memory leak on pc_fw_add_pflash_drv() error path
authorMarkus Armbruster <armbru@redhat.com>
Fri, 23 Nov 2012 18:12:18 +0000 (19:12 +0100)
committerStefan Hajnoczi <stefanha@redhat.com>
Fri, 7 Dec 2012 11:34:12 +0000 (12:34 +0100)
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>
hw/pc_sysfw.c

index 9d7c5f4003025bcf65e2d138849e4024fedd0b23..40bced2322ce86e49bbddc35e6f2b8a215bb008f 100644 (file)
@@ -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,