提交 08af865c 编写于 作者: mysterywolf's avatar mysterywolf

[at][bug] 修复内存泄漏的bug

上级 295b95cd
......@@ -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;
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册