提交 331c18d0 编写于 作者: M Max Bruckner

ensure: only memcopy what's necessary

We don't need to copy the entire printbuffer, only the part that is
used.
上级 4fff9214
......@@ -300,7 +300,7 @@ static unsigned char* ensure(printbuffer *p, size_t needed)
}
if (newbuffer)
{
memcpy(newbuffer, p->buffer, p->length);
memcpy(newbuffer, p->buffer, p->offset + 1);
}
cJSON_free(p->buffer);
}
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册