Fix minor resource leak
Null-terminate buffer before calling strrchr(3)
Untrack automatically generated files
Add gitignore