Plugged another memory leak.

Found by Coverity (CID 17733).
Fixed more memory leaks.

Found by Coverity (CID 14056) and (CID 14055).