[bf-committers] anyone up for a challenge?

Kent Mein mein at cs.umn.edu
Tue Oct 24 17:56:46 CEST 2006

I have a "small" project for anyone that is interested.  

Last month I approached klockwork.com (A company that does commercial
source code analysis) and asked them if they would be willing to
look at the blender code.  What they do is similar to valgrind, but
they get paid to do it, and they generate a pretty report inside of
a bug tracker like system.  

I found an advertisement online saying that they were willing to look at 
open source projects for free.  The only thing they ask in return is that
they are credited with finding the bug.  (So if your going to work on this
and you commit a fix, just mention in the cvslog that your fixing bug(s)
found by them.)

So a couple of days ago we were finally able to get them compiling the
code and working their magic. 

Here is a summary of the report:
Project Name: Blender
Build: build_cvs20061002
Created On: Oct 16, 2006
Files analyzed for defects: 0 (Java), 2403 (C/C++)
Lines of Code: 627671
Number of Defects: 3025

Error Type		#of issues			%
Result of function that may return NULL will be dereferenced	1373	55.84
Result of function that can return NULL may be dereferenced	628	25.54
Memory Leak - possible	62	2.52
Uninitialized Variable - possible	42	1.71
Dereference of 'end' iterator	26	1.06
Suspicious dereference of pointer before NULL check	69	2.81
Memory Leak	64	2.6
Uninitialized Variable	24	0.98
Null pointer will be dereferenced	47	1.91
Null pointer may be dereferenced	64	2.6
Pointer will be dereferenced after it was positively checked for NULL	26	1.06
Uninitialized Variable in Constructor - possible	3	0.12
Null pointer may be passed to function that may dereference it	12	0.49
Suspicious dereference of pointer in function call before NULL check	14	0.57
Use of free memory (passed parameter) - possible	2	0.08
Use of Freed Memory	1	0.04
Inconsistent Case Labels	4	0.16

As you can see there is a lot of stuff to go through.

Here is the details on a fix I am going to commit after sending out this
email, it looks a little ugly as plain text but it is enough info to figure 
out the problem:

/home/klocwork/source/blender/blender_cvs20061002/intern/bsp/intern/BSP_CSGMesh.cpp;81;45;Error;3;LEF_BASE;MLK.MUST;Error;NewCopy;3347949;Memory leak. Dynamic memory stored in 'mesh' allocated through function 'New' at line 73 is lost at line 81. . Also there are 4 similar errors on lines 85, 89, 93, 97.;;New;Analyze;Defects/Memory Management Problems/Memory Leak;70;http://ops:8064/idm/problem.html?project=Blender&pid=70
/home/klocwork/source/blender/blender_cvs20061002/intern/bsp/intern/BSP_CSGMesh.cpp;85;45;Error;3;LEF_BASE;MLK.MIGHT;Error;NewCopy;501517798;Possible memory leak. Dynamic memory stored in 'mesh->m_edges' allocated through function 'new' at line 80 can be lost at line 85. . Also there are 3 similar errors on lines 89, 93, 97.;;New;Analyze;Defects/Memory Management Problems/Memory Leak;71;http://ops:8064/idm/problem.html?project=Blender&pid=71
/home/klocwork/source/blender/blender_cvs20061002/intern/bsp/intern/BSP_CSGMesh.cpp;89;45;Error;3;LEF_BASE;MLK.MIGHT;Error;NewCopy;517258482;Possible memory leak. Dynamic memory stored in 'mesh->m_verts' allocated through function 'new' at line 84 can be lost at line 89. . Also there are 2 similar errors on lines 93, 97.;;New;Analyze;Defects/Memory Management Problems/Memory Leak;72;http://ops:8064/idm/problem.html?project=Blender&pid=72
/home/klocwork/source/blender/blender_cvs20061002/intern/bsp/intern/BSP_CSGMesh.cpp;93;47;Error;3;LEF_BASE;MLK.MIGHT;Error;NewCopy;502348102;Possible memory leak. Dynamic memory stored in 'mesh->m_faces' allocated through function 'new' at line 88 can be lost at line 93. . Also there is one similar error on line 97.;;New;Analyze;Defects/Memory Management Problems/Memory Leak;73;http://ops:8064/idm/problem.html?project=Blender&pid=73
/home/klocwork/source/blender/blender_cvs20061002/intern/bsp/intern/BSP_CSGMesh.cpp;97;49;Error;3;LEF_BASE;MLK.MIGHT;Error;NewCopy;-1977303735;Possible memory leak. Dynamic memory stored in 'mesh->m_fv_data' allocated through function 'new' at line 92 can be lost at line 97;;New;Analyze;Defects/Memory Management Problems/Memory Leak;74;http://ops:8064/idm/problem.html?project=Blender&pid=74
/home/klocwork/source/blender/blender_cvs20061002/intern/bsp/intern/BSP_CSGMesh.cpp;649;12;Error;3;LEF_BASE;ITER.END.DEREF;Error;InsertVertexIntoFace;1131921301;Iterator 'next' retrieved for container 'face.m_verts' at 647:17 is dereferenced when it can be equal to value returned by call to [r]end().;;New;Analyze;Defects/Null Pointer Dereference;75;http://ops:8064/idm/problem.html?project=Blender&pid=75

So if your interested in helping out, let me know, and I can set you up
with an account on their site, and or just give you a report on a specific
subdirectory of the blender code to work on.


mein at cs.umn.edu

More information about the Bf-committers mailing list