From 20ffe2b2a085d5b36bd61c4836b939ba911b7ed9 Mon Sep 17 00:00:00 2001 From: Tatsuhiro Tsujikawa Date: Mon, 10 Nov 2014 21:20:44 +0900 Subject: [PATCH] tiny-nghttpd: Fix memory leak --- examples/tiny-nghttpd.c | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/examples/tiny-nghttpd.c b/examples/tiny-nghttpd.c index 38f3fc72..1bb86b63 100644 --- a/examples/tiny-nghttpd.c +++ b/examples/tiny-nghttpd.c @@ -372,9 +372,20 @@ static connection* connection_new(int fd) static void connection_del(connection *conn) { + stream *strm; + nghttp2_session_del(conn->session); shutdown(conn->fd, SHUT_WR); close(conn->fd); + + strm = conn->strm_head.next; + while(strm) { + stream *next_strm = strm->next; + + stream_del(strm); + strm = next_strm; + } + free(conn); }