diff options
author | Felix Fietkau <nbd@openwrt.org> | 2011-10-03 14:41:51 +0400 |
---|---|---|
committer | Felix Fietkau <nbd@openwrt.org> | 2011-10-03 14:41:51 +0400 |
commit | f24324c27fe8299b22e983171285eb93d4a74721 (patch) | |
tree | f3504840c70080093ec3096d494fbaace0831932 /blob.c | |
parent | 591a1e349f94a4a69dea0c0bb04919a41367c009 (diff) |
explicitly zero extra buffer space added with realloc to silence valgrind warnings
Diffstat (limited to 'blob.c')
-rw-r--r-- | blob.c | 5 |
1 files changed, 4 insertions, 1 deletions
@@ -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; } |