Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

out_s3: fix potential file descriptor leak #7807

Merged
merged 2 commits into from
Aug 29, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions plugins/out_s3/s3.c
Original file line number Diff line number Diff line change
Expand Up @@ -294,6 +294,7 @@ static int read_seq_index(char *seq_index_file, uint64_t *seq_index)

ret = fscanf(fp, "%"PRIu64, seq_index);
if (ret != 1) {
fclose(fp);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Its also needed a few lines below in write_seq_index?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

yup, thanks! Added

flb_errno();
return -1;
}
Expand All @@ -316,6 +317,7 @@ static int write_seq_index(char *seq_index_file, uint64_t seq_index)

ret = fprintf(fp, "%"PRIu64, seq_index);
if (ret < 0) {
fclose(fp);
flb_errno();
return -1;
}
Expand Down