check a malloc()
Remove unused variables
Fix && typo
Remove unused format argument in a fprintf()
Fix compiler pedantic-mode warnings
Make static analyzers feel better about realloc()
change magic numbers to #define-d constants
check more mallocs
Add a note about how the code checks for buffer overflow