From 4586236f3d60a8505c252a3645f873a91815fd6f Mon Sep 17 00:00:00 2001 From: David Malcolm Date: Thu, 16 Jul 2020 17:42:09 -0400 Subject: [PATCH 310/377] FIXME: add FIXME-pr93032-mztools-simplified.c --- FIXME-pr93032-mztools-simplified.c | 26 ++++++++++++++++++++++++++ 1 file changed, 26 insertions(+) create mode 100644 FIXME-pr93032-mztools-simplified.c diff --git a/FIXME-pr93032-mztools-simplified.c b/FIXME-pr93032-mztools-simplified.c new file mode 100644 index 00000000000..492991df5d3 --- /dev/null +++ b/FIXME-pr93032-mztools-simplified.c @@ -0,0 +1,26 @@ +// FIXME +/* Integration test to ensure we issue a FILE * leak diagnostic for + this particular non-trivial case. + Adapted from zlib/contrib/minizip/mztools.c, with all #includes + removed. */ + +/* { dg-do "compile" } */ + +/* Minimal replacement of system headers. */ +#define NULL ((void *) 0) +typedef struct _IO_FILE FILE; +extern FILE *fopen(const char *__restrict __filename, + const char *__restrict __modes); +extern int fclose (FILE *__stream); + +extern void unzRepair(const char* file, const char* fileOut, const char* fileOutTmp) +{ + FILE* fpZip = fopen(file, "rb"); + FILE* fpOut = fopen(fileOut, "wb"); + FILE* fpOutCD = fopen(fileOutTmp, "wb"); + if (fpZip != NULL && fpOut != NULL) { + fclose(fpOutCD); + fclose(fpZip); + fclose(fpOut); + } +} -- 2.26.2