da4e63 fix minor memory leaks and other bugs found by Coverity scan

Authored and Committed by tmraz 6 years ago
    fix minor memory leaks and other bugs found by Coverity scan