From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on dcvr.yhbt.net X-Spam-Level: X-Spam-ASN: X-Spam-Status: No, score=-4.1 required=3.0 tests=ALL_TRUSTED,AWL,BAYES_00, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF shortcircuit=no autolearn=ham autolearn_force=no version=3.4.2 Received: from localhost (dcvr.yhbt.net [127.0.0.1]) by dcvr.yhbt.net (Postfix) with ESMTP id AE6711FAF5 for ; Sat, 10 Dec 2022 10:01:44 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=80x24.org; s=selector1; t=1670666504; bh=7NNzugm9ec/EuIfZzugzlVFbDZ0QH4+Ou+31k4JZik4=; h=From:To:Subject:Date:In-Reply-To:References:From; b=JXBgjGqZbb1/PJuNuIUFy0eHw+OW0hnSSDNgA4NyAFirn8YMWZsNa//V+OEmAb4A0 VAowAMIrY0WNJQAKZb/gc8Ka4X877lDAI0IOrYza9jHFjKTh775oLNUbwyE9JZpfDz G9ygWNOQjTvYs0VReIwBQvZK+Y2YUVWJBqlmzm4E= From: Eric Wong To: mwrap-perl@80x24.org Subject: [PATCH 4/4] httpd: fix leaks when using persistent connections Date: Sat, 10 Dec 2022 10:01:44 +0000 Message-Id: <20221210100144.19796-5-e@80x24.org> In-Reply-To: <20221210100144.19796-1-e@80x24.org> References: <20221210100144.19796-1-e@80x24.org> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit List-Id: Persistent connections is probably not going to be a real use case, but I may end up supporting them anyways. --- mwrap_httpd.h | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/mwrap_httpd.h b/mwrap_httpd.h index fe9f292..ef215c8 100644 --- a/mwrap_httpd.h +++ b/mwrap_httpd.h @@ -173,6 +173,9 @@ static enum mw_qev h1_send_flush(struct mw_h1 *h1) struct mw_wbuf *wbuf = h1->wbuf; struct msghdr mh = { 0 }; + free(h1->h1r); + h1->h1r = NULL; + mh.msg_iov = wbuf->iov + wbuf->iov_written; mh.msg_iovlen = wbuf->iov_nr; do { @@ -674,6 +677,7 @@ static enum mw_qev h1_parse_harder(struct mw_h1 *h1, struct mw_h1req *h1r) char *end; struct phr_header *hdr = h1r->hdr; + h1->prev_len = 0; h1->has_input = 0; h1->persist = h1r->minor_ver >= 1 ? 1 : 0; h1->in_len = 0;