From: Tim Duesterhus Date: Wed, 1 Dec 2021 22:04:15 +0000 (+0100) Subject: BUG/MEDIUM: sample: Fix memory leak in sample_conv_jwt_member_query X-Git-Tag: v2.6-dev1~328 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=caf5f5d3026e5cb00c1428242209624731eeee19;p=thirdparty%2Fhaproxy.git BUG/MEDIUM: sample: Fix memory leak in sample_conv_jwt_member_query The function leaked one full buffer per invocation. Fix this by simply removing the call to alloc_trash_chunk(), the static chunk from get_trash_chunk() is sufficient. This bug was introduced in 0a72f5ee7c2a61bdb379436461269315c776b50a, which is 2.5-dev10. This fix needs to be backported to 2.5+. --- diff --git a/src/sample.c b/src/sample.c index 5abf4712aa..63816be5db 100644 --- a/src/sample.c +++ b/src/sample.c @@ -3584,10 +3584,6 @@ static int sample_conv_jwt_member_query(const struct arg *args, struct sample *s if (item_num < member + 1) goto end; - decoded_header = alloc_trash_chunk(); - if (!decoded_header) - goto end; - ret = base64urldec(items[member].start, items[member].length, decoded_header->area, decoded_header->size); if (ret == -1)