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

John Ferlan jferlan at redhat.com
Sat Sep 26 14:51:29 UTC 2015



On 09/24/2015 10:02 AM, Pavel Hrdina wrote:
> 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.
> 

My turn to make the obvious question... Have you asked the Coverity
folks?  This just seems very strange. I agree it seems to be a false
positive, but something isn't adding up.

John
> 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;
>  
> 




More information about the libvir-list mailing list