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
This commit is contained in:
parent
463476933c
commit
157e5d47b5
@ -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;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user