mirror of
https://github.com/libguestfs/libguestfs.git
synced 2026-03-22 07:03:38 +00:00
launch: Handle guestfs_config qemu_value == NULL.
The second parameter to 'config' may be NULL.
In commit 52fa23d74f (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.
This commit is contained in:
@@ -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));
|
||||
|
||||
@@ -320,7 +320,7 @@ guestfs__config (guestfs_h *g,
|
||||
|
||||
qp = safe_malloc (g, sizeof *qp);
|
||||
qp->qemu_param = safe_strdup (g, qemu_param);
|
||||
qp->qemu_value = safe_strdup (g, qemu_value);
|
||||
qp->qemu_value = qemu_value ? safe_strdup (g, qemu_value) : NULL;
|
||||
|
||||
qp->next = g->qemu_params;
|
||||
g->qemu_params = qp;
|
||||
|
||||
Reference in New Issue
Block a user