release allocated buffers
Merge pull request #183 from evgeny-pasynkov/fix-leak

release allocated buffers