We must free FILE* after function return to not leak resources. Note that
this also closes our fd as fdopen() takes ownership of it.
Reported by Philippe De Swert (via coverity).
}
static void test_read_one_char(void) {
}
static void test_read_one_char(void) {
+ _cleanup_fclose_ FILE *file = NULL;
char r;
bool need_nl;
char name[] = "/tmp/test-read_one_char.XXXXXX";
char r;
bool need_nl;
char name[] = "/tmp/test-read_one_char.XXXXXX";
- _cleanup_close_ int fd = -1;
- FILE *file;
fd = mkostemp_safe(name, O_RDWR|O_CLOEXEC);
assert_se(fd >= 0);
fd = mkostemp_safe(name, O_RDWR|O_CLOEXEC);
assert_se(fd >= 0);