Ensure allocated memory is freed in error conditions
Update deprecated rspec usage
Use Unix instead of DOS line endings