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
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,