From: Philipp Zabel Date: Thu, 27 Apr 2017 16:44:01 +0000 (+0200) Subject: renderonly: close transfer prime_fd X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=ab51cd2f26496500d52f6b2847291d884f711bc2;p=mesa.git renderonly: close transfer prime_fd prime_fd is only used to transfer the scanout buffer to the GPU inside renderonly_create_kms_dumb_buffer_for_resource. It should be closed immediately to avoid leaking the DMA-BUF file handle. Fixes: 848b49b288f ("gallium: add renderonly library") CC: Signed-off-by: Philipp Zabel Reviewed-by: Emil Velikov Reviewed-by: Christian Gmeiner --- diff --git a/src/gallium/auxiliary/renderonly/renderonly.c b/src/gallium/auxiliary/renderonly/renderonly.c index 7e23769159d..e17c32886d2 100644 --- a/src/gallium/auxiliary/renderonly/renderonly.c +++ b/src/gallium/auxiliary/renderonly/renderonly.c @@ -116,6 +116,8 @@ renderonly_create_kms_dumb_buffer_for_resource(struct pipe_resource *rsc, scanout->prime = screen->resource_from_handle(screen, rsc, &handle, PIPE_HANDLE_USAGE_READ_WRITE); + close(prime_fd); + if (!scanout->prime) { fprintf(stderr, "failed to create resource_from_handle: %s\n", strerror(errno)); goto free_dumb;