Revert "Free pointer returned by `basename`"

This reverts commit ffc1e9c4c61191338d04338692683e3ae3fabf59.