diff options
author | Aaron Boxer <boxerab@protonmail.com> | 2023-01-26 14:20:11 -0500 |
---|---|---|
committer | sfan5 <sfan5@live.de> | 2023-01-28 16:54:48 +0100 |
commit | 588d66fb253f11d8282fbd5bed10537e644d8d96 (patch) | |
tree | 948ea1d6571e23536101ec96045219fe27eb96d1 /video/out | |
parent | 881f820fdf33279186b42eeb48820dea88018bd9 (diff) | |
download | mpv-588d66fb253f11d8282fbd5bed10537e644d8d96.tar.bz2 mpv-588d66fb253f11d8282fbd5bed10537e644d8d96.tar.xz |
hwdec_vaapi: close file descriptors even if surface export fails
otherwise they can leak
Diffstat (limited to 'video/out')
-rw-r--r-- | video/out/hwdec/hwdec_vaapi.c | 7 |
1 files changed, 7 insertions, 0 deletions
diff --git a/video/out/hwdec/hwdec_vaapi.c b/video/out/hwdec/hwdec_vaapi.c index 1e339ccaed..51b0933441 100644 --- a/video/out/hwdec/hwdec_vaapi.c +++ b/video/out/hwdec/hwdec_vaapi.c @@ -245,6 +245,12 @@ static int mapper_init(struct ra_hwdec_mapper *mapper) return 0; } +static void close_file_descriptors(VADRMPRIMESurfaceDescriptor desc) +{ + for (int i = 0; i < desc.num_objects; i++) + close(desc.objects[i].fd); +} + static int mapper_map(struct ra_hwdec_mapper *mapper) { struct priv_owner *p_owner = mapper->owner->priv; @@ -261,6 +267,7 @@ static int mapper_map(struct ra_hwdec_mapper *mapper) if (!CHECK_VA_STATUS_LEVEL(mapper, "vaExportSurfaceHandle()", p_owner->probing_formats ? MSGL_DEBUG : MSGL_ERR)) { + close_file_descriptors(desc); goto err; } vaSyncSurface(display, va_surface_id(mapper->src)); |