CID 605799: Resource Leakage in fortune
This commit is contained in:
+3
-2
@@ -37,9 +37,10 @@ choose_file(const char *path)
|
|||||||
count++;
|
count++;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (count == 0)
|
if (count == 0) {
|
||||||
|
closedir(dir);
|
||||||
return -1;
|
return -1;
|
||||||
|
}
|
||||||
// choose and open entry
|
// choose and open entry
|
||||||
|
|
||||||
chosen = rand() % count;
|
chosen = rand() % count;
|
||||||
|
|||||||
Reference in New Issue
Block a user