diff options
author | Kieran Bingham <kieran.bingham@ideasonboard.com> | 2021-07-15 16:23:34 +0100 |
---|---|---|
committer | Kieran Bingham <kieran.bingham@ideasonboard.com> | 2021-08-05 08:53:59 +0100 |
commit | 32858e88f6f3248dcbe073a740f33fb5dda330a4 (patch) | |
tree | 827dd6a4b28ecde4d90d59102ee46cd043c38345 | |
parent | 68a0be3ce975ab85af0d64fc1669ef0fdb552fb5 (diff) |
DNI: CTS Workaround for fd leak
Signed-off-by: Kieran Bingham <kieran.bingham@ideasonboard.com>
Change-Id: I59d271b5d684787fe7919fad8432df942fa35d53
-rw-r--r-- | src/libcamera/ipa_data_serializer.cpp | 11 |
1 files changed, 10 insertions, 1 deletions
diff --git a/src/libcamera/ipa_data_serializer.cpp b/src/libcamera/ipa_data_serializer.cpp index fb941e6b..c5b0d4fb 100644 --- a/src/libcamera/ipa_data_serializer.cpp +++ b/src/libcamera/ipa_data_serializer.cpp @@ -7,6 +7,8 @@ #include "libcamera/internal/ipa_data_serializer.h" +#include <unistd.h> + #include <libcamera/base/log.h> /** @@ -547,7 +549,14 @@ FileDescriptor IPADataSerializer<FileDescriptor>::deserialize(std::vector<uint8_ ASSERT(!(valid && std::distance(fdsBegin, fdsEnd) < 1)); - return valid ? FileDescriptor(*fdsBegin) : FileDescriptor(); + FileDescriptor fd = valid ? FileDescriptor(*fdsBegin) : FileDescriptor(); + if (valid && *fdsBegin != -1) { + LOG(IPADataSerializer, Error) << "We probably leaked an fd"; + close(*fdsBegin); + //fdsBegin = -1; /// Can't do this on the const iterator. + } + + return fd; } template<> |