From 4792efa1198a7421f092fb8f9459abeb13d4f11d Mon Sep 17 00:00:00 2001 From: cwx1272435 Date: Fri, 16 Aug 2024 06:36:10 +0000 Subject: [PATCH] cherry pick 1c255a5 from https://gitee.com/ymcaiq/commonlibrary_memory_utils/pulls/162 memory_utils code modify Signed-off-by: cwx1272435 --- libdmabufheap/src/dmabuf_alloc.c | 5 +++-- libpurgeablemem/c/src/purgeable_memory.c | 2 +- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/libdmabufheap/src/dmabuf_alloc.c b/libdmabufheap/src/dmabuf_alloc.c index 02dec9d..3db3851 100644 --- a/libdmabufheap/src/dmabuf_alloc.c +++ b/libdmabufheap/src/dmabuf_alloc.c @@ -32,8 +32,9 @@ static bool IsHeapNameValid(const char *heapName) { - if ((heapName == NULL) || (strlen(heapName) == 0) || - (strlen(heapName) > HEAP_NAME_MAX_LEN)) { + size_t len = strlen(heapName); + if ((heapName == NULL) || (len == 0) || + (len > HEAP_NAME_MAX_LEN)) { return false; } diff --git a/libpurgeablemem/c/src/purgeable_memory.c b/libpurgeablemem/c/src/purgeable_memory.c index b0cf21b..918a616 100644 --- a/libpurgeablemem/c/src/purgeable_memory.c +++ b/libpurgeablemem/c/src/purgeable_memory.c @@ -12,7 +12,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -#include "pthread.h" +#include #include "purgeable_mem_builder_c.h" #include "purgeable_mem_c.h" -- Gitee