MFC r315720 (from cem@)
scandir: Fix NULL dereference, uninitialized value use in error case
This bug was introduced in r315095. Given that it obviously is a bug and
we can't afford to have such creatures in libc, do an early merge,
Reported by: Coverity
CIDs: 1329566, 1372625
Sponsored by: Dell EMC Isilon