From: John Ferlan Date: Wed, 27 Aug 2014 12:51:15 +0000 (-0400) Subject: domain_conf: Resolve Coverity REVERSE_INULL X-Git-Url: http://xenbits.xensource.com/gitweb?a=commitdiff_plain;h=0c5ca985971a349e5b4125faa5b48cd57b38cb0a;p=libvirt.git domain_conf: Resolve Coverity REVERSE_INULL Coverity complains that checking for domain->def being non NULL in the if (live) path of virDomainObjAssignDef() would be unnecessary or a NULL deref since the call to virDomainObjIsActive() would already dereference domain->def when checking if the def->id field was != -1. Checked all callers to virDomainObjAssignDef() and each at some point dereferences (vm)->def->{field} prior to calling when live is true. --- diff --git a/src/conf/domain_conf.c b/src/conf/domain_conf.c index 53733379cd..48afb8c5c9 100644 --- a/src/conf/domain_conf.c +++ b/src/conf/domain_conf.c @@ -2247,13 +2247,11 @@ void virDomainObjAssignDef(virDomainObjPtr domain, domain->newDef = def; } else { if (live) { - if (domain->def) { - /* save current configuration to be restored on domain shutdown */ - if (!domain->newDef) - domain->newDef = domain->def; - else - virDomainDefFree(domain->def); - } + /* save current configuration to be restored on domain shutdown */ + if (!domain->newDef) + domain->newDef = domain->def; + else + virDomainDefFree(domain->def); domain->def = def; } else { if (oldDef)