[PATCH weston 2/2] vaapi-recorder: Don't leak drm fd
Ander Conselvan de Oliveira
ander.conselvan.de.oliveira at intel.com
Fri Sep 6 07:49:38 PDT 2013
Make vaapi_recorder take onwership of the fd and close it at destroy
time.
---
src/compositor-drm.c | 1 -
src/vaapi-recorder.c | 4 +++-
2 files changed, 3 insertions(+), 2 deletions(-)
diff --git a/src/compositor-drm.c b/src/compositor-drm.c
index 7f6ffbc..68406da 100644
--- a/src/compositor-drm.c
+++ b/src/compositor-drm.c
@@ -2523,7 +2523,6 @@ recorder_binding(struct weston_seat *seat, uint32_t time, uint32_t key,
weston_log("[libva recorder] initialized\n");
} else {
vaapi_recorder_destroy(output->recorder);
- /* FIXME: close drm fd passed to recorder */
output->recorder = NULL;
output->base.disable_planes--;
diff --git a/src/vaapi-recorder.c b/src/vaapi-recorder.c
index e9127da..84848e4 100644
--- a/src/vaapi-recorder.c
+++ b/src/vaapi-recorder.c
@@ -87,7 +87,7 @@
#define PROFILE_IDC_HIGH 100
struct vaapi_recorder {
- int output_fd;
+ int drm_fd, output_fd;
int width, height;
int frame_count;
@@ -942,6 +942,7 @@ vaapi_recorder_create(int drm_fd, int width, int height, const char *filename)
r->width = width;
r->height = height;
+ r->drm_fd = drm_fd;
flags = O_WRONLY | O_CREAT | O_TRUNC | O_CLOEXEC;
r->output_fd = open(filename, flags, 0644);
@@ -1000,6 +1001,7 @@ vaapi_recorder_destroy(struct vaapi_recorder *r)
vaTerminate(r->va_dpy);
close(r->output_fd);
+ close(r->drm_fd);
free(r);
}
--
1.8.1.2
More information about the wayland-devel
mailing list