]> git.ipfire.org Git - thirdparty/haproxy.git/commitdiff
MINOR: qpack: fix memory leak on huffman decoding
authorAmaury Denoyelle <adenoyelle@haproxy.com>
Thu, 30 Sep 2021 15:14:55 +0000 (17:14 +0200)
committerAmaury Denoyelle <adenoyelle@haproxy.com>
Fri, 8 Oct 2021 13:45:57 +0000 (15:45 +0200)
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.

src/qpack-dec.c

index 54e7f164ad3e6815087b970eea3503d137b1629c..a67ecb78fe450b45fb30d46e465f973159539c32 100644 (file)
@@ -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;