Fixed a bug with c|cpp autodetection, removed few memory leaks after valgrind check (now only llvm internals are sources of lost bytes)