From b79f7b5a29be03497f4e50d59a6860886029b4b7 Mon Sep 17 00:00:00 2001
From: mildis <me@mildis.org>
Date: Sun, 23 Sep 2018 18:15:55 +0200
Subject: [PATCH] BUG/MINOR: h2: null-deref

h2c can be null if pool_alloc() failed.
Check h2c before working on it.
---
 src/mux_h2.c | 8 +++++---
 1 file changed, 5 insertions(+), 3 deletions(-)

diff --git a/src/mux_h2.c b/src/mux_h2.c
index 61603811..f6bf5fc8 100644
--- a/src/mux_h2.c
+++ b/src/mux_h2.c
@@ -427,9 +427,11 @@ static int h2c_frt_init(struct connection *conn)
  fail:
 	if (t)
 		task_free(t);
-	if (h2c->wait_list.task)
-		tasklet_free(h2c->wait_list.task);
-	pool_free(pool_head_h2c, h2c);
+	if (h2c) {
+		if (h2c->wait_list.task)
+			tasklet_free(h2c->wait_list.task);
+		pool_free(pool_head_h2c, h2c);
+	}
 	return -1;
 }
 
-- 
2.19.0

