diff --git a/src/bin/fortune.c b/src/bin/fortune.c index bb04fd7273..1303c53bf5 100644 --- a/src/bin/fortune.c +++ b/src/bin/fortune.c @@ -37,9 +37,10 @@ choose_file(const char *path) count++; } - if (count == 0) + if (count == 0) { + closedir(dir); return -1; - + } // choose and open entry chosen = rand() % count;