[Cocci] trying to understand the output of coccicheck

Julia Lawall julia at diku.dk
Tue May 4 13:29:13 CEST 2010

On Tue, 4 May 2010, Brice Goglin wrote:

> Hello,
> I am trying to run coccicheck on KNEM
> (http://runtime.bordeaux.inria.fr/knem/) and I can't understand what it
> is complaining about. I am using coccicheck 0.2.4 (with a couple fixes
> to make it work with coccinelle 0.2.2). After running, all my
> results/*.out files are empty, except malloc.out (attached). I can't
> believe coccicheck is telling me that I should removed the lines
> mentioned in this diff patch since my malloc is certainly needed :) So I
> guess I just don't understand what coccicheck is saying. Would you mind
> helping me?

I think you are running coccicheck with the diff option.  This uses 
semantic patches with *s, which are implemented as removals, but are 
really just suggestions to look at the given line.  The benefit of using 
diff and - is that in emacs you can put the buffer in diff mode and then 
get it to jump directly to the place in your source file.  In looking 
quickly at the code, I think it is showing you a malloc and an exit point 
at which nothing has been done with the allocated value but it has not 
been freed either.  Ie you have a memory leak.


More information about the Cocci mailing list