Skip to content

Commit bb91401

Browse files
Update std.c
1 parent 5880303 commit bb91401

1 file changed

Lines changed: 10 additions & 0 deletions

File tree

test/cfg/std.c

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -386,6 +386,16 @@ void resourceLeak_tmpfile(void)
386386
// cppcheck-suppress resourceLeak
387387
}
388388

389+
void resourceLeak_freopen(FILE* f1)
390+
{
391+
if (freopen(NULL, "w+b", f1) == NULL) {} // #14171
392+
393+
FILE *f2 = fopen("file.txt", "r");
394+
// cppcheck-suppress [ignoredReturnValue, nullPointerOutOfResources]
395+
freopen("file.txt", "r", f2);
396+
// cppcheck-suppress resourceLeak
397+
}
398+
389399
// memory leak
390400

391401
void ignoreleak(void)

0 commit comments

Comments
 (0)