nyx/tests/fixtures/state/nested_branch_leak.c

17 lines
457 B
C
Raw Normal View History

#include <stdio.h>
/* Nested if — only the innermost branch closes.
Path truetrue: fclose CLOSED (clean)
Path truefalse: no close OPEN (leak)
Path false: no close OPEN (leak)
Joined at exit: OPEN|CLOSED may-leak.
Expected: state-resource-leak-possible. */
void nested_branch_leak(int a, int b) {
FILE *f = fopen("data.txt", "r");
if (a) {
if (b) {
fclose(f);
}
}
}