Pushed all the code through Coverity static analyzer, fixed the bugs it found. Fought with some malloc, free bugs; some sqaushed; others just commented free() and living with memory leak.
Merge remote-tracking branch 'origin/master'