Fix bug: double free

Signed-off-by: Jianhui Zhao <jianhuizhao329@gmail.com>
main
Jianhui Zhao 2017-11-12 17:23:54 +08:00
parent 751e541776
commit deefdd2f9d
1 changed files with 1 additions and 4 deletions

View File

@ -34,10 +34,7 @@ int uh_buf_grow(struct uh_buf *buf, size_t size)
void uh_buf_free(struct uh_buf *buf) void uh_buf_free(struct uh_buf *buf)
{ {
if (buf->base) { uh_buf_init(buf, 0);
free(buf->base);
uh_buf_init(buf, 0);
}
} }
size_t uh_buf_append(struct uh_buf *buf, const void *data, size_t len) size_t uh_buf_append(struct uh_buf *buf, const void *data, size_t len)