summaryrefslogtreecommitdiff
path: root/components
diff options
context:
space:
mode:
authorqiyongzhong0 <[email protected]>2020-11-02 17:43:23 +0800
committerqiyongzhong0 <[email protected]>2020-11-02 17:43:23 +0800
commitdb0880bd2675cfb097d15147940a32e272db1c89 (patch)
tree2dedab4677c056880f2857d04eedd4a58f98f1ba /components
parent60e9808677107415be51d75948f2e1a6b982cdab (diff)
fix at_client, avoid creating the same client repeatedly and prevent working exceptions and memory leaks.
Diffstat (limited to 'components')
-rw-r--r--components/net/at/src/at_client.c5
1 files changed, 5 insertions, 0 deletions
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)