explicitly zero extra buffer space added with realloc to silence valgrind warnings
This commit is contained in:
parent
591a1e349f
commit
f24324c27f
1 changed files with 4 additions and 1 deletions
5
blob.c
5
blob.c
|
@ -18,8 +18,11 @@
|
|||
static bool
|
||||
blob_buffer_grow(struct blob_buf *buf, int minlen)
|
||||
{
|
||||
buf->buflen += ((minlen / 256) + 1) * 256;
|
||||
int delta = ((minlen / 256) + 1) * 256;
|
||||
buf->buflen += delta;
|
||||
buf->buf = realloc(buf->buf, buf->buflen);
|
||||
if (buf->buf)
|
||||
memset(buf->buf + buf->buflen - delta, 0, delta);
|
||||
return !!buf->buf;
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue