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

Chris Wilson chris at chris-wilson.co.uk
Tue Dec 3 16:24:24 UTC 2019


Quoting Ville Syrjala (2019-12-03 15:35:53)
> 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);
>         }

On igt_device_get_card_index() fail there's also a leak.

Reviewed-by: Chris Wilson <chris at chris-wilson.co.uk>
-Chris


More information about the igt-dev mailing list