From fa2b2c211025953f162c4d7935ed86db0db560d7 Mon Sep 17 00:00:00 2001 From: Birte Kristina Friesel Date: Fri, 17 Nov 2023 19:15:18 +0100 Subject: add_stdin_to_filelist: fix resource leak upon fwrite failure Closes #730 --- src/filelist.c | 1 + 1 file changed, 1 insertion(+) (limited to 'src') 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; } } -- cgit v1.2.3