]> git.ipfire.org Git - thirdparty/libvirt.git/commit
libxl: Fix Coverity warning
authorJim Fehlig <jfehlig@suse.com>
Wed, 4 Sep 2013 20:27:20 +0000 (14:27 -0600)
committerJim Fehlig <jfehlig@suse.com>
Wed, 4 Sep 2013 21:32:24 +0000 (15:32 -0600)
commit5236aed83f54fca2e7072262aa29416b281e620a
treecdb3c5ecd61d309332c3f06dcd6b12b0b92ed96b
parentc021f5cecc0cea9537b3838003af1a1d313a942f
libxl: Fix Coverity warning

John Ferlan reported the following Coverity warning:

In libxlDomainCoreDump() Coverity has noted a FORWARD_NULL reference:

2004      if ((flags & VIR_DUMP_CRASH) && !vm->persistent) {
2005          virDomainObjListRemove(driver->domains, vm);

(20) Event assign_zero:  Assigning: "vm" = "NULL".
Also see events:  [var_deref_model]

2006          vm = NULL;
2007      }
2008
2009      ret = 0;
2010
2011  cleanup_unpause:

(21) Event var_deref_model:  Passing null pointer "vm" to function
     "virDomainObjIsActive(virDomainObjPtr)", which dereferences it. [details]
Also see events:  [assign_zero]

2012      if (virDomainObjIsActive(vm) && paused) {
2013          if (libxl_domain_unpause(priv->ctx, dom->id) != 0) {
2014              virReportError(VIR_ERR_INTERNAL_ERROR,

Removing the vm from domain obj list and setting it to NULL can be
done in the previous 'if (flags & VIR_DUMP_CRASH)' conditional.  Fix
the Coverity warning by ensuring vm is not NULL before testing if it
is still active.
src/libxl/libxl_driver.c