From 544322815d0c34f76ef163914c5abeb7a04058ba Mon Sep 17 00:00:00 2001 From: ngie Date: Wed, 4 May 2016 00:30:36 +0000 Subject: MFC r298311,r298312: r298311: Make sure fmemopen succeeds in :test_append_binary_pos before calling ftell on the FILE object This fixes potential null pointer dereferences on failure CID: 1254952 r298312: Fix double fclose of `fp1` when freopen fails freopen handles closing file descriptors on error, with the exception of fdopen'ed descriptors, so closing an already fclose'd file descriptor is incorrect CID: 1338525 --- lib/libc/tests/stdio/freopen_test.c | 1 - 1 file changed, 1 deletion(-) (limited to 'lib/libc/tests/stdio/freopen_test.c') diff --git a/lib/libc/tests/stdio/freopen_test.c b/lib/libc/tests/stdio/freopen_test.c index 1719927..8ca4719 100644 --- a/lib/libc/tests/stdio/freopen_test.c +++ b/lib/libc/tests/stdio/freopen_test.c @@ -48,7 +48,6 @@ runtest(const char *fname1, const char *mode1, const char *fname2, "fopen(\"%s\", \"%s\") failed; errno=%d", fname1, mode1, errno); fp2 = freopen(fname2, mode2, fp1); if (fp2 == NULL) { - fclose(fp1); ATF_REQUIRE_MSG(success == false, "freopen(\"%s\", \"%s\", fopen(\"%s\", \"%s\")) succeeded " "unexpectedly", fname2_print, mode2, fname1, mode1); -- cgit v1.1