sysdir: free the path if we cannot find the file

Returning an error cleared the buf, but this operation does not free the
memory associated with it. Use git_buf_free() instead.