Coverity resource leaks and bug fixes
Added coverity build script
Coverity issues fixed