From: Daniel P. Berrangé Date: Tue, 18 Jun 2019 17:36:52 +0000 (+0100) Subject: conf: add error checking of UUID generation X-Git-Tag: v5.5.0-rc1~219 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=473d2eba04ae7e2867b59ca2130ae030278693c5;p=thirdparty%2Flibvirt.git conf: add error checking of UUID generation Reviewed-by: John Ferlan Signed-off-by: Daniel P. Berrangé --- diff --git a/src/conf/domain_conf.c b/src/conf/domain_conf.c index ee651e7742..c69d382d70 100644 --- a/src/conf/domain_conf.c +++ b/src/conf/domain_conf.c @@ -30415,7 +30415,11 @@ virDomainNetDefToNetworkPort(virDomainDefPtr dom, if (VIR_ALLOC(port) < 0) return NULL; - virUUIDGenerate(port->uuid); + if (virUUIDGenerate(port->uuid) < 0) { + virReportError(VIR_ERR_INTERNAL_ERROR, + "%s", _("Failed to generate UUID")); + goto error; + } memcpy(port->owneruuid, dom->uuid, VIR_UUID_BUFLEN); if (VIR_STRDUP(port->ownername, dom->name) < 0) @@ -30576,7 +30580,11 @@ virDomainNetDefActualToNetworkPort(virDomainDefPtr dom, return NULL; /* Bad - we need to preserve original port uuid */ - virUUIDGenerate(port->uuid); + if (virUUIDGenerate(port->uuid) < 0) { + virReportError(VIR_ERR_INTERNAL_ERROR, + "%s", _("Failed to generate UUID")); + goto error; + } memcpy(port->owneruuid, dom->uuid, VIR_UUID_BUFLEN); if (VIR_STRDUP(port->ownername, dom->name) < 0)