mirror of
https://github.com/elicpeter/nyx.git
synced 2026-06-15 20:05:13 +02:00
12 lines
340 B
C
12 lines
340 B
C
|
|
#include <stdio.h>
|
||
|
|
|
||
|
|
/* Two separate handles: f1 is closed, f2 is leaked.
|
||
|
|
Expected: state-resource-leak for f2, NO state-resource-leak for f1.
|
||
|
|
(The finding message should contain "f2".) */
|
||
|
|
void multiple_handles(void) {
|
||
|
|
FILE *f1 = fopen("a.txt", "r");
|
||
|
|
FILE *f2 = fopen("b.txt", "r");
|
||
|
|
fclose(f1);
|
||
|
|
/* f2 never closed */
|
||
|
|
}
|