From: Amaury Denoyelle Date: Thu, 30 Sep 2021 15:14:55 +0000 (+0200) Subject: MINOR: qpack: fix memory leak on huffman decoding X-Git-Tag: v2.5-dev9~33 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=9c8c4fa3a25d8489955d3e98b46238109e0fed12;p=thirdparty%2Fhaproxy.git MINOR: qpack: fix memory leak on huffman decoding Remove an unneeded strdup invocation during QPACK huffman decoding. A temporary storage buffer is passed by the function and exists after decoding so no need to duplicate memory here. --- diff --git a/src/qpack-dec.c b/src/qpack-dec.c index 54e7f164ad..a67ecb78fe 100644 --- a/src/qpack-dec.c +++ b/src/qpack-dec.c @@ -311,7 +311,9 @@ int qpack_decode_fs(const unsigned char *raw, size_t len, struct buffer *tmp, } qpack_debug_printf(stderr, " [name huff %d->%d '%s']", (int)length, (int)nlen, trash); - list[hdr_idx].v = ist(strdup(trash)); + /* makes an ist from tmp storage */ + b_add(tmp, nlen); + list[hdr_idx].v = ist2(trash, nlen); } /* XXX Value string XXX */ raw += length;