From: David Carlier Date: Fri, 25 Sep 2015 10:58:12 +0000 (+0100) Subject: MINOR: chunk: New function free_trash_buffers() X-Git-Tag: v1.6-dev6~25 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=60deeba090c4e3292edd5119f51faf35adda3f53;p=thirdparty%2Fhaproxy.git MINOR: chunk: New function free_trash_buffers() This new function is meant to be called in the general deinit phase, to free those two internal chunks. --- diff --git a/include/common/chunk.h b/include/common/chunk.h index 18f41af54f..8225d96f18 100644 --- a/include/common/chunk.h +++ b/include/common/chunk.h @@ -48,6 +48,7 @@ int chunk_asciiencode(struct chunk *dst, struct chunk *src, char qc); int chunk_strcmp(const struct chunk *chk, const char *str); int chunk_strcasecmp(const struct chunk *chk, const char *str); int alloc_trash_buffers(int bufsize); +void free_trash_buffers(void); struct chunk *get_trash_chunk(void); static inline void chunk_reset(struct chunk *chk) diff --git a/src/chunk.c b/src/chunk.c index 3c1cfdffcb..1359adc0c0 100644 --- a/src/chunk.c +++ b/src/chunk.c @@ -65,6 +65,17 @@ int alloc_trash_buffers(int bufsize) return trash_buf1 && trash_buf2; } +/* + * free the trash buffers + */ +void free_trash_buffers(void) +{ + free(trash_buf2); + free(trash_buf1); + trash_buf2 = NULL; + trash_buf1 = NULL; +} + /* * Does an snprintf() at the beginning of chunk , respecting the limit of * at most chk->size chars. If the chk->len is over, nothing is added. Returns