mirror of
https://github.com/RGBCube/serenity
synced 2025-05-31 13:28:11 +00:00
FileManger: Fix file descriptor leak in copy_file_or_directory, found by Coverity
This commit is contained in:
parent
bcbac83a8b
commit
e43d5d5eaa
1 changed files with 3 additions and 0 deletions
|
@ -26,6 +26,7 @@
|
|||
|
||||
#include "FileUtils.h"
|
||||
#include <AK/LexicalPath.h>
|
||||
#include <AK/ScopeGuard.h>
|
||||
#include <AK/StringBuilder.h>
|
||||
#include <LibCore/DirIterator.h>
|
||||
#include <stdio.h>
|
||||
|
@ -86,6 +87,8 @@ bool copy_file_or_directory(const String& src_path, const String& dst_path)
|
|||
return false;
|
||||
}
|
||||
|
||||
ScopeGuard close_fd_guard([src_fd]() { close(src_fd); });
|
||||
|
||||
struct stat src_stat;
|
||||
int rc = fstat(src_fd, &src_stat);
|
||||
if (rc < 0) {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue