diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/libcamera/v4l2_videodevice.cpp | 9 |
1 files changed, 8 insertions, 1 deletions
diff --git a/src/libcamera/v4l2_videodevice.cpp b/src/libcamera/v4l2_videodevice.cpp index d35596bd..fbe55bc6 100644 --- a/src/libcamera/v4l2_videodevice.cpp +++ b/src/libcamera/v4l2_videodevice.cpp @@ -1276,7 +1276,14 @@ FileDescriptor V4L2VideoDevice::exportDmabufFd(unsigned int index, return FileDescriptor(); } - return FileDescriptor(expbuf.fd); + FileDescriptor fd(expbuf.fd); + /* + * FileDescriptor takes a duplicate of fd, so we must close the + * original here, otherwise it will be left dangling. + */ + ::close(expbuf.fd); + + return fd; } /** |