summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMatteo Valdina <matteo.valdina@gmail.com>2019-05-24 15:43:24 -0500
committerXiang, Haihao <haihao.xiang@intel.com>2019-06-03 10:57:48 +0800
commiteefe4be48cba838b4f2d761d797a4c9ac0027c9c (patch)
treee3de1adcadab2c9da4d127b79afa41a044bc94e7
parent7b859a9b143fb9ea73b3b84950665bfa280a9372 (diff)
downloadlibva-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.c4
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;
}