[DF-2344] Fixed memory leaks