From 5e59969dbb7313228bc8641e5e611a8ecd0eadcf Mon Sep 17 00:00:00 2001 From: Paul Elder Date: Sat, 27 Dec 2025 10:38:28 +0900 Subject: [PATCH] libcamera: control_serializer: Remove unnecessary allocation MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit In between versions of the patch "libcamera: control_serializer: Add array info to serialized ControlValue", ipa_control_value_entry was changed to be members of ipa_control_info_entry as opposed to being serialized at the same level. The binarySize/entriesSize computation was not updated, however, leaving some extra memory allocated for the serialized form of ControlInfoMap. Fix this by removing the extra size for 3 * ipa_control_value_entry. Signed-off-by: Paul Elder Reviewed-by: Daniel Scally Reviewed-by: Barnabás Pőcze Reviewed-by: Laurent Pinchart --- src/libcamera/control_serializer.cpp | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/src/libcamera/control_serializer.cpp b/src/libcamera/control_serializer.cpp index 843e2772..c0285cc6 100644 --- a/src/libcamera/control_serializer.cpp +++ b/src/libcamera/control_serializer.cpp @@ -164,8 +164,7 @@ size_t ControlSerializer::binarySize(const ControlInfo &info) size_t ControlSerializer::binarySize(const ControlInfoMap &infoMap) { size_t size = sizeof(struct ipa_controls_header) - + infoMap.size() * (sizeof(struct ipa_control_info_entry) + - 3 * sizeof(struct ipa_control_value_entry)); + + infoMap.size() * sizeof(struct ipa_control_info_entry); for (const auto &ctrl : infoMap) size += binarySize(ctrl.second); @@ -234,8 +233,7 @@ int ControlSerializer::serialize(const ControlInfoMap &infoMap, /* Compute entries and data required sizes. */ size_t entriesSize = infoMap.size() - * (sizeof(struct ipa_control_info_entry) + - 3 * sizeof(struct ipa_control_value_entry)); + * sizeof(struct ipa_control_info_entry); size_t valuesSize = 0; for (const auto &ctrl : infoMap) valuesSize += binarySize(ctrl.second);