projects
/
project
/
libubox.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
| inline |
side by side
(parent:
591a1e3
)
explicitly zero extra buffer space added with realloc to silence valgrind warnings
author
Felix Fietkau
<nbd@openwrt.org>
Mon, 3 Oct 2011 10:41:51 +0000
(12:41 +0200)
committer
Felix Fietkau
<nbd@openwrt.org>
Mon, 3 Oct 2011 10:41:51 +0000
(12:41 +0200)
blob.c
patch
|
blob
|
history
diff --git
a/blob.c
b/blob.c
index edf55d480c5b5cc5a9eb3e3d694772c612bb27db..4bc67a8d5407f594f139e7908b081b340a854bf1 100644
(file)
--- 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;
}