Use correct pointer
Fix some unsigned char/signed char issues
Check if variable if valid before freeing
Remove unused variable
Handle a few signed/unsigned conflicts
Refactored code for reading reverse bitmap
Initialize some variables
Don't write terminating null in 'line' out of bounds.