Skip to content

Commit

Permalink
Close path opened by fr_mkdir() to avoid fd leak (CID #1636671)
Browse files Browse the repository at this point in the history
In fr_bio_fd_reopen(), if cfg->mkdir is true, it tries to create
a directory and returns -1 if it fails. If it succeeds, the
path number of the created direcctory is stored in fd...and the
next use of fd is assigning the result of open() to it, leaving
the directory open and accumulating inaccessible open files.
  • Loading branch information
jejones3141 committed Dec 10, 2024
1 parent c314a2c commit 0d1c6ed
Showing 1 changed file with 1 addition and 0 deletions.
1 change: 1 addition & 0 deletions src/lib/bio/fd_open.c
Original file line number Diff line number Diff line change
Expand Up @@ -1239,6 +1239,7 @@ int fr_bio_fd_reopen(fr_bio_t *bio)
}) < 0)) {
return -1;
}
if (cfg->mkdir) close(fd);

/*
* Create it if necessary.
Expand Down

0 comments on commit 0d1c6ed

Please sign in to comment.