TS-1475: Fix memory leak in regression test. Coverity #1022153