Unverified Commit 157e5d47 authored by Moshe Kaplan's avatar Moshe Kaplan Committed by GitHub
Browse files

util.c: Don't leak directory handle if recursive call to dirRemove fails (#12800)

If a recursive call to dirRemove() returns -1, dirRemove() the directory
handle stored in dir will leak. This change closes the directory handle
stored in dir even if the recursive call to dirRemove() returns -1.

Fixed Coverity 371073
parent 46347693
...@@ -1061,6 +1061,7 @@ int dirRemove(char *dname) { ...@@ -1061,6 +1061,7 @@ int dirRemove(char *dname) {
if (S_ISDIR(stat_entry.st_mode) != 0) { if (S_ISDIR(stat_entry.st_mode) != 0) {
if (dirRemove(full_path) == -1) { if (dirRemove(full_path) == -1) {
closedir(dir);
return -1; return -1;
} }
continue; continue;
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment