mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2024-11-14 05:12:09 +00:00
va: Fix dmabuf handle leaks
Close dmabuf handles manually when they're not going to be passed into GStreamer FD memory, to avoid fd handle leaks. Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/7240>
This commit is contained in:
parent
f11735c97b
commit
1ebbcc31ef
1 changed files with 10 additions and 0 deletions
|
@ -628,6 +628,11 @@ _va_create_surface_and_export_to_dmabuf (GstVaDisplay * display,
|
|||
|
||||
failed:
|
||||
{
|
||||
/* Free DMAbufs on failure */
|
||||
for (guint32 i = 0; i < desc.num_objects; i++) {
|
||||
gint fd = desc.objects[i].fd;
|
||||
close (fd);
|
||||
}
|
||||
va_destroy_surfaces (display, &surface, 1);
|
||||
return FALSE;
|
||||
}
|
||||
|
@ -660,6 +665,11 @@ gst_va_dmabuf_get_modifier_for_format (GstVaDisplay * display,
|
|||
NULL, 0, &info, &surface, &desc))
|
||||
return DRM_FORMAT_MOD_INVALID;
|
||||
|
||||
/* Close the fds we won't be using */
|
||||
for (guint32 i = 0; i < desc.num_objects; i++) {
|
||||
gint fd = desc.objects[i].fd;
|
||||
close (fd);
|
||||
}
|
||||
va_destroy_surfaces (display, &surface, 1);
|
||||
|
||||
return desc.objects[0].drm_format_modifier;
|
||||
|
|
Loading…
Reference in a new issue