[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]

Re: [libvirt] [PATCH 1/3] lxc: Resolve Coverity warning



On 07/23/13 17:59, John Ferlan wrote:
Commit 'c8695053' resulted in the following:

Coverity error seen in the output:
     ERROR: REVERSE_INULL
     FUNCTION: lxcProcessAutoDestroy

Due to the 'dom' being checked before 'dom->persistent' since 'dom'
is already dereferenced prior to that.
---
  src/lxc/lxc_process.c | 2 +-
  1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/src/lxc/lxc_process.c b/src/lxc/lxc_process.c
index 5b83ccb..5c4f8c8 100644
--- a/src/lxc/lxc_process.c
+++ b/src/lxc/lxc_process.c
@@ -74,7 +74,7 @@ lxcProcessAutoDestroy(virDomainObjPtr dom,
                                       VIR_DOMAIN_EVENT_STOPPED_DESTROYED);
      priv->doneStopEvent = true;

-    if (dom && !dom->persistent) {
+    if (!dom->persistent) {
          virDomainObjListRemove(driver->domains, dom);
          dom = NULL;
      }


ACK, dom is indeed dereferenced before, thus it will not crash here.

Peter


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]