From 08af865c50e74dd8f1d9b680f7d95618a5ba529c Mon Sep 17 00:00:00 2001 From: Meco Man <920369182@qq.com> Date: Wed, 17 Mar 2021 13:56:42 +0800 Subject: [PATCH 1/2] =?UTF-8?q?[at][bug]=20=E4=BF=AE=E5=A4=8D=E5=86=85?= =?UTF-8?q?=E5=AD=98=E6=B3=84=E6=BC=8F=E7=9A=84bug?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- components/net/at/src/at_client.c | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/components/net/at/src/at_client.c b/components/net/at/src/at_client.c index 5e077512ae..81416be90b 100644 --- a/components/net/at/src/at_client.c +++ b/components/net/at/src/at_client.c @@ -104,18 +104,23 @@ void at_delete_resp(at_response_t resp) */ at_response_t at_resp_set_info(at_response_t resp, rt_size_t buf_size, rt_size_t line_num, rt_int32_t timeout) { + char *p_temp; RT_ASSERT(resp); if (resp->buf_size != buf_size) { resp->buf_size = buf_size; - resp->buf = (char *) rt_realloc(resp->buf, buf_size); - if (!resp->buf) + p_temp = (char *) rt_realloc(resp->buf, buf_size); + if (p_temp == RT_NULL) { LOG_D("No memory for realloc response buffer size(%d).", buf_size); return RT_NULL; } + else + { + resp->buf = p_temp; + } } resp->line_num = line_num; From c40fd2da7097c80b3013966b358a5ecb21ccbcbd Mon Sep 17 00:00:00 2001 From: Meco Man <920369182@qq.com> Date: Wed, 17 Mar 2021 14:00:49 +0800 Subject: [PATCH 2/2] update --- components/net/at/src/at_client.c | 1 + 1 file changed, 1 insertion(+) diff --git a/components/net/at/src/at_client.c b/components/net/at/src/at_client.c index 81416be90b..a613ea1435 100644 --- a/components/net/at/src/at_client.c +++ b/components/net/at/src/at_client.c @@ -8,6 +8,7 @@ * 2018-03-30 chenyong first version * 2018-04-12 chenyong add client implement * 2018-08-17 chenyong multiple client support + * 2021-03-17 Meco Man fix a buf of leaking memory */ #include