diff options
author | Matteo Valdina <matteo.valdina@gmail.com> | 2019-05-24 15:43:24 -0500 |
---|---|---|
committer | Xiang, Haihao <haihao.xiang@intel.com> | 2019-06-03 10:57:48 +0800 |
commit | eefe4be48cba838b4f2d761d797a4c9ac0027c9c (patch) | |
tree | e3de1adcadab2c9da4d127b79afa41a044bc94e7 | |
parent | 7b859a9b143fb9ea73b3b84950665bfa280a9372 (diff) | |
download | libva-intel-driver-eefe4be48cba838b4f2d761d797a4c9ac0027c9c.tar.gz |
wayland: Fix for FD leaks in case of invalid image format
In the case the va_GetSurfaceBufferWl is not able to create a prime or planar buffer it will leak the FD get from DRM.
-rw-r--r-- | src/i965_output_wayland.c | 4 |
1 files changed, 4 insertions, 0 deletions
diff --git a/src/i965_output_wayland.c b/src/i965_output_wayland.c index a637552e..a6120b7b 100644 --- a/src/i965_output_wayland.c +++ b/src/i965_output_wayland.c @@ -332,6 +332,8 @@ va_GetSurfaceBufferWl( drm_format = WL_DRM_FORMAT_YUV444; break; default: + if (fd != -1) + close(fd); return VA_STATUS_ERROR_INVALID_IMAGE_FORMAT; } offsets[0] = 0; @@ -342,6 +344,8 @@ va_GetSurfaceBufferWl( pitches[2] = obj_surface->cb_cr_pitch; break; default: + if (fd != -1) + close(fd); return VA_STATUS_ERROR_INVALID_IMAGE_FORMAT; } |