mirror of
https://gitlab.com/libvirt/libvirt.git
synced 2025-03-07 17:28:15 +00:00
virNodeDeviceDefParse: Don't call post-parse callbacks with NULL def
When parsing of the node device XML fails we'd still call the post-parse and validation callbacks which makes no sense. Additionally the callbacks were expecting a non-NULL pointer which leads to a crash. Resolves: https://bugzilla.redhat.com/show_bug.cgi?id=2014139 Fixes: d5ae634ba28 Signed-off-by: Peter Krempa <pkrempa@redhat.com> Reviewed-by: Erik Skultety <eskultet@redhat.com>
This commit is contained in:
parent
289aa4bc5b
commit
8eb08e0fc5
@ -2177,10 +2177,10 @@ virNodeDeviceDefParse(const char *str,
|
|||||||
g_autoptr(xmlDoc) xml = NULL;
|
g_autoptr(xmlDoc) xml = NULL;
|
||||||
g_autoptr(virNodeDeviceDef) def = NULL;
|
g_autoptr(virNodeDeviceDef) def = NULL;
|
||||||
|
|
||||||
if ((xml = virXMLParse(filename, str, _("(node_device_definition)"), NULL, false))) {
|
if (!(xml = virXMLParse(filename, str, _("(node_device_definition)"), NULL, false)) ||
|
||||||
def = virNodeDeviceDefParseNode(xml, xmlDocGetRootElement(xml),
|
!(def = virNodeDeviceDefParseNode(xml, xmlDocGetRootElement(xml),
|
||||||
create, virt_type);
|
create, virt_type)))
|
||||||
}
|
return NULL;
|
||||||
|
|
||||||
if (parserCallbacks) {
|
if (parserCallbacks) {
|
||||||
int ret = 0;
|
int ret = 0;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user