]> git.ipfire.org Git - thirdparty/haproxy.git/commitdiff
BUG/MEDIUM: sample: Fix memory leak in sample_conv_jwt_member_query
authorTim Duesterhus <tim@bastelstu.be>
Wed, 1 Dec 2021 22:04:15 +0000 (23:04 +0100)
committerChristopher Faulet <cfaulet@haproxy.com>
Fri, 3 Dec 2021 08:03:55 +0000 (09:03 +0100)
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+.

src/sample.c

index 5abf4712aa3c91c1709f870559207980cd19c4f5..63816be5dba1635b84d275e6ce84d2e74c772a29 100644 (file)
@@ -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)