From 9ba04deca686d25223e66238d5e308e66c7c8cdf Mon Sep 17 00:00:00 2001 From: John Ferlan Date: Wed, 27 Aug 2014 08:01:44 -0400 Subject: [PATCH] domain_conf: Resolve Coverity REVERSE_INULL In virDomainActualNetDefFormat() a call to virDomainNetGetActualType(def) was made before a check for (!def) a few lines later. This triggered Coverity to note the possible NULL deref. Just moving the initialization to after the !def checks resolves the issue --- src/conf/domain_conf.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/src/conf/domain_conf.c b/src/conf/domain_conf.c index 91f92a4651..53733379cd 100644 --- a/src/conf/domain_conf.c +++ b/src/conf/domain_conf.c @@ -16211,11 +16211,13 @@ virDomainActualNetDefFormat(virBufferPtr buf, virDomainNetDefPtr def, unsigned int flags) { - unsigned int type = virDomainNetGetActualType(def); - const char *typeStr = virDomainNetTypeToString(type); + unsigned int type; + const char *typeStr; if (!def) return 0; + type = virDomainNetGetActualType(def); + typeStr = virDomainNetTypeToString(type); if (!typeStr) { virReportError(VIR_ERR_INTERNAL_ERROR, -- GitLab