aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDaniel P. Berrange <berrange@redhat.com>2012-09-14 15:35:33 +0100
committerDaniel P. Berrange <berrange@redhat.com>2012-09-14 17:15:37 +0100
commit731c911ceb977a11572f4311e8cd96740337bfa1 (patch)
tree85390e0f44fd7965bd65dbd3f793877450ac1df3
parentFix 3 broken test cases which were mistakenly raising errors (diff)
downloadlibvirt-731c911ceb977a11572f4311e8cd96740337bfa1.tar.gz
libvirt-731c911ceb977a11572f4311e8cd96740337bfa1.tar.bz2
libvirt-731c911ceb977a11572f4311e8cd96740337bfa1.zip
Fix initialization of virCommandPtr when creating QEMU argv
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
-rw-r--r--src/qemu/qemu_command.c8
1 files changed, 7 insertions, 1 deletions
diff --git a/src/qemu/qemu_command.c b/src/qemu/qemu_command.c
index d0c8e22af..b8c5658f5 100644
--- a/src/qemu/qemu_command.c
+++ b/src/qemu/qemu_command.c
@@ -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;