]> git.ipfire.org Git - thirdparty/haproxy.git/commitdiff
BUG/MEDIUM: map: Fix memory leak in the map converter
authorNenad Merdanovic <nmerdan@haproxy.com>
Fri, 12 Apr 2019 20:54:28 +0000 (22:54 +0200)
committerWilly Tarreau <w@1wt.eu>
Mon, 15 Apr 2019 07:53:46 +0000 (09:53 +0200)
The allocated trash chunk is not freed properly and causes a memory leak
exhibited as the growth in the trash pool allocations. Bug was introduced
in commit 271022 (BUG/MINOR: map: fix map_regm with backref).

This should be backported to all branches where the above commit was
backported.

src/map.c

index 903c5b267ea5d3a3ae42bbdc42f2c8e2a58dfeb4..cf14893070bc0101c63a444bee2ccfcca9863d06 100644 (file)
--- a/src/map.c
+++ b/src/map.c
@@ -207,6 +207,8 @@ static int sample_conv_map(const struct arg *arg_p, struct sample *smp, void *pr
                                                  tmptrash->area,
                                                  pat->data->u.str.area,
                                                  (regmatch_t *)smp->ctx.a[0]);
+                               free_trash_chunk(tmptrash);
+
                                if (len == -1)
                                        return 0;