From 473d2eba04ae7e2867b59ca2130ae030278693c5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Daniel=20P=2E=20Berrang=C3=A9?= Date: Tue, 18 Jun 2019 18:36:52 +0100 Subject: [PATCH] conf: add error checking of UUID generation MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Reviewed-by: John Ferlan Signed-off-by: Daniel P. Berrangé --- src/conf/domain_conf.c | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) 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)