[igt-dev] [PATCH i-g-t 2/4] lib/igt_kms: Don't leak fds when forcing connector multiple times

Ville Syrjala ville.syrjala at linux.intel.com
Tue Dec 3 15:35:53 UTC 2019


From: Ville Syrjälä <ville.syrjala at linux.intel.com>

Close the new sysfs directory fd when we've already forced
the same connector previously. Currently we're leaking the fd.

Signed-off-by: Ville Syrjälä <ville.syrjala at linux.intel.com>
---
 lib/igt_kms.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/lib/igt_kms.c b/lib/igt_kms.c
index 74ae98d774f1..ba1657d06d45 100644
--- a/lib/igt_kms.c
+++ b/lib/igt_kms.c
@@ -1075,6 +1075,8 @@ bool kmstest_force_connector(int drm_fd, drmModeConnector *connector,
 	if (len != -1 && len < MAX_CONNECTORS) {
 		forced_connectors[len] = path;
 		forced_connectors_device[len] = dir;
+	} else {
+		close(dir);
 	}
 
 	if (len >= MAX_CONNECTORS)
-- 
2.23.0



More information about the igt-dev mailing list