Skip to content

Commit

Permalink
- Fix buffer reset.
Browse files Browse the repository at this point in the history
  • Loading branch information
basil00 committed Feb 22, 2015
1 parent fdcec53 commit 3878455
Showing 1 changed file with 4 additions and 5 deletions.
9 changes: 4 additions & 5 deletions pseudo_node.c
Original file line number Diff line number Diff line change
Expand Up @@ -584,11 +584,10 @@ static uint64_t rand64(void)
static struct buf *alloc_buf(jmp_buf *env)
{
struct buf *buf = (struct buf *)mem_alloc(sizeof(struct buf));
size_t len = BUFFER_SIZE;
char *data = (char *)mem_alloc(len);
char *data = (char *)mem_alloc(BUFFER_SIZE);
buf->env = env;
buf->data = data;
buf->len = len;
buf->len = BUFFER_SIZE;
buf->ptr = 0;
buf->ref_count = 1;
return buf;
Expand All @@ -600,9 +599,9 @@ static void reset_buf(struct buf *buf)
if (buf->len > BUFFER_SIZE)
{
mem_free(buf->data);
buf->len = BUFFER_SIZE;
buf->data = (char *)mem_alloc(buf->len);
buf->data = (char *)mem_alloc(BUFFER_SIZE);
}
buf->len = BUFFER_SIZE;
buf->ptr = 0;
}

Expand Down

0 comments on commit 3878455

Please sign in to comment.