timob-12176: memory leak fix
timob-12176: optimization