Merge pull request #4948 from libgit2/ethomson/memleaks repository: free memory in symlink detection function