diff options
author | Richard W.M. Jones <rjones@redhat.com> | 2012-09-21 12:42:53 +0100 |
---|---|---|
committer | Richard W.M. Jones <rjones@redhat.com> | 2012-09-21 12:57:11 +0100 |
commit | 1b364d74a8d42c956abdf4c5dbbc56cf1e250033 (patch) | |
tree | 7b4a3b54dfe16f180148fbfa2fc80ba7f8033ca2 /src/launch-libvirt.c | |
parent | 763ec36cf0c6ffa6d359b65ff7f1ee9ab1c7361e (diff) | |
download | libguestfs-1b364d74a8d42c956abdf4c5dbbc56cf1e250033.tar.gz libguestfs-1b364d74a8d42c956abdf4c5dbbc56cf1e250033.tar.xz libguestfs-1b364d74a8d42c956abdf4c5dbbc56cf1e250033.zip |
launch: Handle guestfs_config qemu_value == NULL.
The second parameter to 'config' may be NULL.
In commit 52fa23d74f6308daf804c2330b0b27e0b4412594 (refactoring of
guestfs_config) the code this got lost, and guestfs_config would
segfault if qemu_value was NULL.
Also this fixes the libvirt method to handle the same case.
I checked libguestfs-1.18 and -1.16 branches, and this problem does
NOT affect them.
Diffstat (limited to 'src/launch-libvirt.c')
-rw-r--r-- | src/launch-libvirt.c | 12 |
1 files changed, 7 insertions, 5 deletions
diff --git a/src/launch-libvirt.c b/src/launch-libvirt.c index f6fa36f0..c055504a 100644 --- a/src/launch-libvirt.c +++ b/src/launch-libvirt.c @@ -1103,11 +1103,13 @@ construct_libvirt_xml_qemu_cmdline (guestfs_h *g, xmlTextWriterPtr xo) BAD_CAST qp->qemu_param)); XMLERROR (-1, xmlTextWriterEndElement (xo)); - XMLERROR (-1, xmlTextWriterStartElement (xo, BAD_CAST "qemu:arg")); - XMLERROR (-1, - xmlTextWriterWriteAttribute (xo, BAD_CAST "value", - BAD_CAST qp->qemu_value)); - XMLERROR (-1, xmlTextWriterEndElement (xo)); + if (qp->qemu_value) { + XMLERROR (-1, xmlTextWriterStartElement (xo, BAD_CAST "qemu:arg")); + XMLERROR (-1, + xmlTextWriterWriteAttribute (xo, BAD_CAST "value", + BAD_CAST qp->qemu_value)); + XMLERROR (-1, xmlTextWriterEndElement (xo)); + } } XMLERROR (-1, xmlTextWriterEndElement (xo)); |