detection.c: Bugfix. Added a 'closedir' that had been ommitted, removed the 'free' that had become invalid as a result.