Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.openwrt.org/project/libubox.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
path: root/blob.c
diff options
context:
space:
mode:
authorFelix Fietkau <nbd@openwrt.org>2011-10-03 14:41:51 +0400
committerFelix Fietkau <nbd@openwrt.org>2011-10-03 14:41:51 +0400
commitf24324c27fe8299b22e983171285eb93d4a74721 (patch)
treef3504840c70080093ec3096d494fbaace0831932 /blob.c
parent591a1e349f94a4a69dea0c0bb04919a41367c009 (diff)
explicitly zero extra buffer space added with realloc to silence valgrind warnings
Diffstat (limited to 'blob.c')
-rw-r--r--blob.c5
1 files changed, 4 insertions, 1 deletions
diff --git a/blob.c b/blob.c
index edf55d4..4bc67a8 100644
--- a/blob.c
+++ b/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;
}