MINOR: chunks: allocate the trash chunks before parsing the config

get_trash_chunk() is convenient also while parsing the config, better
allocate them early just like the global trash.
diff --git a/src/cfgparse.c b/src/cfgparse.c
index 0a39d22..579dbcc 100644
--- a/src/cfgparse.c
+++ b/src/cfgparse.c
@@ -609,6 +609,7 @@
 		if (global.tune.maxrewrite >= global.tune.bufsize / 2)
 			global.tune.maxrewrite = global.tune.bufsize / 2;
 		chunk_init(&trash, realloc(trash.str, global.tune.bufsize), global.tune.bufsize);
+		alloc_trash_buffers(global.tune.bufsize);
 	}
 	else if (!strcmp(args[0], "tune.maxrewrite")) {
 		if (*(args[1]) == 0) {
diff --git a/src/chunk.c b/src/chunk.c
index 9463abb..f84ab10 100644
--- a/src/chunk.c
+++ b/src/chunk.c
@@ -51,12 +51,14 @@
 	return trash_chunk;
 }
 
-/* Allocates the trash buffers. Returns 0 in case of failure. */
+/* (re)allocates the trash buffers. Returns 0 in case of failure. It is
+ * possible to call this function multiple times if the trash size changes.
+ */
 int alloc_trash_buffers(int bufsize)
 {
 	trash_size = bufsize;
-	trash_buf1 = (char *)calloc(1, bufsize);
-	trash_buf2 = (char *)calloc(1, bufsize);
+	trash_buf1 = (char *)realloc(trash_buf1, bufsize);
+	trash_buf2 = (char *)realloc(trash_buf2, bufsize);
 	return trash_buf1 && trash_buf2;
 }
 
diff --git a/src/haproxy.c b/src/haproxy.c
index 86d1899..0ec217e 100644
--- a/src/haproxy.c
+++ b/src/haproxy.c
@@ -491,6 +491,7 @@
 	struct tm curtime;
 
 	chunk_init(&trash, malloc(global.tune.bufsize), global.tune.bufsize);
+	alloc_trash_buffers(global.tune.bufsize);
 
 	/* NB: POSIX does not make it mandatory for gethostname() to NULL-terminate
 	 * the string in case of truncation, and at least FreeBSD appears not to do
@@ -817,7 +818,6 @@
 	swap_buffer = (char *)calloc(1, global.tune.bufsize);
 	get_http_auth_buff = (char *)calloc(1, global.tune.bufsize);
 	static_table_key = calloc(1, sizeof(*static_table_key) + global.tune.bufsize);
-	alloc_trash_buffers(global.tune.bufsize);
 
 	fdinfo = (struct fdinfo *)calloc(1,
 				       sizeof(struct fdinfo) * (global.maxsock));