[PATCH i-g-t v2] tests/sw_sync: fix invalid fd test
Luka Mamrikishvili <[email protected]>
| Newsgroups | org.freedesktop.lists.igt-dev |
|---|---|
| Message-ID | <[email protected]> |
The invalid file fd test overwrites the file descriptor returned by mkstemp() with a DRM device file descriptor. As a result, it tests a device fd twice instead of testing a regular file fd, and leaks both the first device fd and temporary file fd. Close the device fd after its test and retain the temporary file fd for the file fd test. Signed-off-by: Luka Mamrikishvili <[email protected]> v2: - Add the i-g-t subject tag for CI. --- tests/sw_sync.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/sw_sync.c b/tests/sw_sync.c index 8012652d6..a75ec044b 100644 --- a/tests/sw_sync.c +++ b/tests/sw_sync.c @@ -334,6 +334,7 @@ static void test_sync_merge_invalid(void) fence_invalid = drm_open_driver(DRIVER_ANY); fence_merge = sync_fence_merge(in_fence, fence_invalid); igt_assert_f(fence_merge < 0, "Verify invalid fd (device fd) handling"); + close(fence_invalid); fence_invalid = mkstemp(tmppath); if (fence_invalid == -1) { @@ -341,7 +342,6 @@ static void test_sync_merge_invalid(void) goto out; } unlink(tmppath); - fence_invalid = drm_open_driver(DRIVER_ANY); fence_merge = sync_fence_merge(in_fence, fence_invalid); close(fence_invalid); igt_assert_f(fence_merge < 0, "Verify invalid fd (file fd) handling"); -- 2.55.0