fix up 'dir' leak

caught by coverity.