Fixed coverity found bugs at tools. There is, maybe, a remaining memory leak.
Fixed coverity found bugs at examples.
Fixed coverity found bugs at tests.