[libvirt] [libvirt-python PATCH 23/23] coverity: resolve dead_error_condition

Pavel Hrdina phrdina at redhat.com
Thu Sep 24 14:02:00 UTC 2015


Coverity cannot introspect the cpython code and it thinks, that if the
PyTuple_New or similar will always give the same result.  In functions
where the python function is called more than once with the same
arguments, it will assume that if the first call don't return NULL, then
also the every other call cannot return NULL.  This is a wrong
assumption and it's a false-positive.

Signed-off-by: Pavel Hrdina <phrdina at redhat.com>
---
 libvirt-override.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/libvirt-override.c b/libvirt-override.c
index 3192e74..5330d0f 100644
--- a/libvirt-override.c
+++ b/libvirt-override.c
@@ -5409,6 +5409,7 @@ libvirt_virEventAddTimeoutFunc(int timeout,
     Py_INCREF(python_cb);
     VIR_PY_TUPLE_SET_GOTO(pyobj_args, 1, python_cb, cleanup);
 
+    /* coverity[notnull] */
     if ((cb_args = PyTuple_New(3)) == NULL)
         goto cleanup;
 
@@ -6125,6 +6126,7 @@ libvirt_virConnectDomainEventGraphicsCallback(virConnectPtr conn ATTRIBUTE_UNUSE
                          libvirt_constcharPtrWrap(local->service),
                          cleanup);
 
+    /* coverity[notnull] */
     if ((pyobj_remote = PyDict_New()) == NULL)
         goto cleanup;
 
-- 
2.5.3




More information about the libvir-list mailing list