TS-1475: Fix memory leak of format object which is copied. Coverity #1022143