]> xenbits.xensource.com Git - people/liuw/libxenctrl-split/libvirt.git/commitdiff
Fix initialization of virCommandPtr when creating QEMU argv
authorDaniel P. Berrange <berrange@redhat.com>
Fri, 14 Sep 2012 14:35:33 +0000 (15:35 +0100)
committerDaniel P. Berrange <berrange@redhat.com>
Fri, 14 Sep 2012 16:15:37 +0000 (17:15 +0100)
If the qemuBuildCommandLine method raised an error before the
virCommandPtr instance was created, the local var would not
be initialized, resulting in a possible SEGV in the error
cleanup branch. Also add some debugging of the method params

src/qemu/qemu_command.c

index d0c8e22af9f6815dac02a965e08352d3ea322ea8..b8c5658f5aa406b018f1d4a55f1692712659433a 100644 (file)
@@ -4407,12 +4407,18 @@ qemuBuildCommandLine(virConnectPtr conn,
     char *smp;
     int last_good_net = -1;
     bool hasHwVirt = false;
-    virCommandPtr cmd;
+    virCommandPtr cmd = NULL;
     bool emitBootindex = false;
     int usbcontroller = 0;
     bool usblegacy = false;
     uname_normalize(&ut);
 
+    VIR_DEBUG("conn=%p driver=%p def=%p mon=%p json=%d "
+              "caps=%p migrateFrom=%s migrateFD=%d "
+              "snapshot=%p vmop=%d",
+              conn, driver, def, monitor_chr, monitor_json,
+              caps, migrateFrom, migrateFd, snapshot, vmop);
+
     virUUIDFormat(def->uuid, uuid);
 
     emulator = def->emulator;