From 5d3af603a6778d087eed5c597cc71b43f2bfdf77 Mon Sep 17 00:00:00 2001 From: tgotic Date: Thu, 11 Aug 2022 18:14:35 +0200 Subject: [PATCH] update code to use osi_free() --- components/bt/common/btc/core/btc_task.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/components/bt/common/btc/core/btc_task.c b/components/bt/common/btc/core/btc_task.c index 89865986a0..5127cb5f3f 100644 --- a/components/bt/common/btc/core/btc_task.c +++ b/components/bt/common/btc/core/btc_task.c @@ -222,7 +222,8 @@ bt_status_t btc_transfer_context(btc_msg_t *msg, void *arg, int arg_len, btc_arg { btc_msg_t* lmsg; - if (msg == NULL) { + // arg XOR arg_len + if ((msg == NULL) || ((arg == NULL) == !(arg_len == 0))) { return BT_STATUS_PARM_INVALID; } @@ -237,7 +238,7 @@ bt_status_t btc_transfer_context(btc_msg_t *msg, void *arg, int arg_len, btc_arg if (arg) { lmsg->arg = (void *)osi_malloc(arg_len); if (lmsg->arg == NULL) { - free(lmsg); + osi_free(lmsg); return BT_STATUS_NOMEM; } memset(lmsg->arg, 0x00, arg_len); //important, avoid arg which have no length