summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/libcamera/ipa_data_serializer.cpp11
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<>