mirror of
https://github.com/systemd/systemd.git
synced 2024-11-07 18:27:04 +03:00
test: fix mem-leak in fdopen() test
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).
This commit is contained in:
parent
2b347169b9
commit
3f2e132a19
Notes:
Lennart Poettering
2014-10-24 18:14:15 +02:00
Backport: bugfix
@ -918,11 +918,11 @@ static void test_readlink_and_make_absolute(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";
|
||||
_cleanup_close_ int fd = -1;
|
||||
FILE *file;
|
||||
int fd;
|
||||
|
||||
fd = mkostemp_safe(name, O_RDWR|O_CLOEXEC);
|
||||
assert_se(fd >= 0);
|
||||
|
Loading…
Reference in New Issue
Block a user