Fix memory leak issue, added test file
Merge pull request #16 from andyhu/master

Fix memory leak issue when pipe to a slow stream