fixed some memory problems, add 'make scan' to run clang static analyzer