From: Felix Fietkau Date: Mon, 3 Oct 2011 10:41:51 +0000 (+0200) Subject: explicitly zero extra buffer space added with realloc to silence valgrind warnings X-Git-Url: http://git.archive.openwrt.org/?p=project%2Flibubox.git;a=commitdiff_plain;h=f24324c27fe8299b22e983171285eb93d4a74721 explicitly zero extra buffer space added with realloc to silence valgrind warnings --- 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; }