Attached is an image from a coverity report for ctypes.

Here is the text:

3866            val = Simple_get_value(self);
3867            if (val == NULL)
3868                    return NULL;
3869    
3870            name = PyString_FromString(self->ob_type->tp_name);

Event var_compare_op: Added "name" due to comparison "name == 0"
Also see events: [var_deref_op]
At conditional (1): "name == 0" taking true path

3871            if (name == NULL) {

Event var_deref_op: Variable "name" tracked as NULL was dereferenced.
Also see events: [var_compare_op]

3872                    Py_DECREF(name);
3873                    return NULL;
3874            }
3875    
3876            args = PyTuple_Pack(2, name, val);
3877            Py_DECREF(name);
3878            Py_DECREF(val);
3879            if (args == NULL)
3880                    return NULL;

What is being described is that name is known to be NULL and it is
being free()d which is incorrect.  As you can see from the context,
line 3872 (of Modules/_ctypes/_ctypes.c) should be Py_DECREF(val);

n

<<attachment: ctypes-coverity.jpg>>

_______________________________________________
Python-Dev mailing list
Python-Dev@python.org
http://mail.python.org/mailman/listinfo/python-dev
Unsubscribe: 
http://mail.python.org/mailman/options/python-dev/archive%40mail-archive.com

Reply via email to