summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBirte Kristina Friesel <derf@finalrewind.org>2023-11-17 19:15:18 +0100
committerBirte Kristina Friesel <derf@finalrewind.org>2023-11-17 19:15:18 +0100
commitfa2b2c211025953f162c4d7935ed86db0db560d7 (patch)
treee35ee6a80349ca7b3042bad5a34a155d65a5a84d
parentb86f22bbd30e5a29c90bb5744e97802ae02b4745 (diff)
add_stdin_to_filelist: fix resource leak upon fwrite failure
Closes #730
-rw-r--r--src/filelist.c1
1 files changed, 1 insertions, 0 deletions
diff --git a/src/filelist.c b/src/filelist.c
index 223956d..f1e820c 100644
--- a/src/filelist.c
+++ b/src/filelist.c
@@ -180,6 +180,7 @@ static void add_stdin_to_filelist(void)
while ((readsize = fread(buf, sizeof(char), sizeof(buf), stdin)) > 0) {
if (fwrite(buf, sizeof(char), readsize, outfile) < readsize) {
free(sfn);
+ fclose(outfile);
return;
}
}