From be3da5089ceeba97045d6e84ef4239735c20d657 Mon Sep 17 00:00:00 2001 From: Daniel Agar Date: Mon, 7 Feb 2022 12:43:30 -0500 Subject: [PATCH] uORB: uORBDeviceNode use px4_cache_aligned_alloc --- platforms/common/uORB/uORBDeviceNode.cpp | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/platforms/common/uORB/uORBDeviceNode.cpp b/platforms/common/uORB/uORBDeviceNode.cpp index 597e70e9a1..25dc68a04a 100644 --- a/platforms/common/uORB/uORBDeviceNode.cpp +++ b/platforms/common/uORB/uORBDeviceNode.cpp @@ -84,7 +84,7 @@ uORB::DeviceNode::DeviceNode(const struct orb_metadata *meta, const uint8_t inst uORB::DeviceNode::~DeviceNode() { - delete[] _data; + free(_data); const char *devname = get_devname(); @@ -186,7 +186,9 @@ uORB::DeviceNode::write(cdev::file_t *filp, const char *buffer, size_t buflen) /* re-check size */ if (nullptr == _data) { - _data = new uint8_t[_meta->o_size * _queue_size]; + const size_t data_size = _meta->o_size * _queue_size; + _data = (uint8_t *) px4_cache_aligned_alloc(data_size); + memset(_data, 0, data_size); } unlock();