Fixed memory free bug on error in bs_put.
Merge pull request #24 from wimrijnders/master

Fixed memory free bug on error in bs_put.