aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorThomas White <taw@physics.org>2013-02-22 17:39:26 +0100
committerThomas White <taw@physics.org>2013-02-22 17:39:26 +0100
commitfe8352bf60638f0da55669bd9e55a75ad7e300e4 (patch)
treeec6ade0438f8ff149dd1b4a868e246024e4839c2
parent14ae5be04e0564781b54c166c0587616eed3bb9e (diff)
Keep Valgrind quiet
-rw-r--r--src/im-sandbox.c9
1 files changed, 8 insertions, 1 deletions
diff --git a/src/im-sandbox.c b/src/im-sandbox.c
index 290f811f..1ba6b2ce 100644
--- a/src/im-sandbox.c
+++ b/src/im-sandbox.c
@@ -127,6 +127,7 @@ static char *get_pattern(FILE *fh, char **use_this_one_instead,
{
char *line;
char *filename;
+ size_t len;
do {
@@ -160,7 +161,13 @@ static char *get_pattern(FILE *fh, char **use_this_one_instead,
line = tmp;
}
- filename = malloc(strlen(prefix)+strlen(line)+1);
+ len = strlen(prefix)+strlen(line)+1;
+
+ /* Round the length of the buffer, too keep Valgrind quiet when it gets
+ * given to write() a bit later on */
+ len += 4 - (len % 4);
+
+ filename = malloc(len);
snprintf(filename, 1023, "%s%s", prefix, line);