Use g_clear_fd() instead of open coding the same behavior

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/2806>
This commit is contained in:
Jonas Ådahl
2023-01-25 21:33:18 +01:00
committed by Marge Bot
parent f34c6da956
commit 49b0a8921c
4 changed files with 8 additions and 13 deletions

View File

@ -27,6 +27,7 @@
#include <drm_fourcc.h>
#include <gio/gio.h>
#include <glib/gstdio.h>
#include <xf86drm.h>
#include <fcntl.h>
#include <sys/mman.h>
@ -343,8 +344,7 @@ destroy_dumb_buffer (MetaDrmBufferDumb *buffer_dumb)
};
drmIoctl (fd, DRM_IOCTL_MODE_DESTROY_DUMB, &destroy_arg);
if (buffer_dumb->dmabuf_fd != -1)
close (buffer_dumb->dmabuf_fd);
g_clear_fd (&buffer_dumb->dmabuf_fd, NULL);
}
static void