]> git.ipfire.org Git - thirdparty/haproxy.git/commitdiff
MINOR: chunk: New function free_trash_buffers()
authorDavid Carlier <dcarlier@afilias.info>
Fri, 25 Sep 2015 10:58:12 +0000 (11:58 +0100)
committerWilly Tarreau <w@1wt.eu>
Mon, 28 Sep 2015 12:00:00 +0000 (14:00 +0200)
This new function is meant to be called in the general deinit phase,
to free those two internal chunks.

include/common/chunk.h
src/chunk.c

index 18f41af54f07908e09dc97b5731bda494b8e5434..8225d96f18bcb53681e7f32ed58c81468f8de354 100644 (file)
@@ -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)
index 3c1cfdffcbca647825e1479b0c0f74a5a4b157ff..1359adc0c0a7d4c20c9dcbf2f1d90e210f263f1a 100644 (file)
@@ -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 <chk>, respecting the limit of
  * at most chk->size chars. If the chk->len is over, nothing is added. Returns