Merge fix for TRQ-2525, trq-2548, trq-2549: Valgrind issues.