TS-1475: Coverity 1021655 - fix use after free.
TS-1475: Coverity 1021828 Resource leak
TS-1475: Coverity 1021656 - fix use after free.
TS-1475: Coverity 1226155 Resource leak
TS-1475: Coverity 1021657 - fix use after free.
TS-1475: Coverity 1021790 - fix resource leak.
TS-1475: Coverity 1021817 - fix resource leak.
TS-1475: Coverity 1021818 - fix resource leak.
TS-1475: Coverity 1021819 - fix resource leak.
TS-1475: Coverity 1021820 - fix resource leak.
TS-1475: Coverity 1196454 - fix resource leak
TS-1475: Coverity 1021791,1021792 - fix resource leaks
TS-1475: Coverity 1021829 Resource leak
TS-1475: Coverity 1021862 Out-of-bounds access
warning suppressed