[Python-Dev] Coverity report (original) (raw)
Neal Norwitz nnorwitz at gmail.com
Tue Mar 14 07:55:23 CET 2006
- Previous message: [Python-Dev] Topic suggestions from the PyCon feedback
- Next message: [Python-Dev] Threading idea -- exposing a global thread lock
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
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 -------------- next part -------------- A non-text attachment was scrubbed... Name: ctypes-coverity.jpg Type: image/jpeg Size: 40797 bytes Desc: not available Url : http://mail.python.org/pipermail/python-dev/attachments/20060313/77fda0ac/attachment-0001.jpg
- Previous message: [Python-Dev] Topic suggestions from the PyCon feedback
- Next message: [Python-Dev] Threading idea -- exposing a global thread lock
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]