LLVM and clang include a C code static analyzer called scan-build. Use it calling
scan-build "make distclean && ./config.sh && make"
More information:
http://grep.be/blog/en/computer/code/static_analysis_with_clang