eliminated possible memory leak
Merge pull request #2229 from ilya-lavrenov:possible_memory_leak