conf: Skip virDomainNetDefParseXMLDriver if driver_node is NULL

Trying to parse <driver> node which does not exist makes no sense.

Signed-off-by: Jiri Denemark <jdenemar@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
This commit is contained in:
Jiri Denemark 2022-11-02 14:42:51 +01:00
parent 0e23ef8222
commit ce7a33b48f

View File

@ -8831,8 +8831,10 @@ virDomainNetDefParseXMLDriver(virDomainNetDef *def,
{
xmlNodePtr driver_node;
if ((driver_node = virXPathNode("./driver", ctxt)) &&
(virDomainVirtioOptionsParseXML(driver_node, &def->virtio) < 0))
if (!(driver_node = virXPathNode("./driver", ctxt)))
return 0;
if (virDomainVirtioOptionsParseXML(driver_node, &def->virtio) < 0)
return -1;
if (def->type != VIR_DOMAIN_NET_TYPE_HOSTDEV &&