[DF-2763] Fixed memory leaks