From db0880bd2675cfb097d15147940a32e272db1c89 Mon Sep 17 00:00:00 2001 From: qiyongzhong0 <917768104@qq.com> Date: Mon, 2 Nov 2020 17:43:23 +0800 Subject: [PATCH] fix at_client, avoid creating the same client repeatedly and prevent working exceptions and memory leaks. --- components/net/at/src/at_client.c | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/components/net/at/src/at_client.c b/components/net/at/src/at_client.c index ba4009738d..788549392d 100644 --- a/components/net/at/src/at_client.c +++ b/components/net/at/src/at_client.c @@ -917,6 +917,11 @@ int at_client_init(const char *dev_name, rt_size_t recv_bufsz) RT_ASSERT(dev_name); RT_ASSERT(recv_bufsz > 0); + if (at_client_get(dev_name) != RT_NULL) + { + return result; + } + for (idx = 0; idx < AT_CLIENT_NUM_MAX && at_client_table[idx].device; idx++); if (idx >= AT_CLIENT_NUM_MAX)