From 92736b267738a7e3b4e827c103690f5c8b367773 Mon Sep 17 00:00:00 2001 From: Tim Bart Date: Tue, 3 Dec 2019 04:29:40 -0800 Subject: [PATCH] bug(cloudflared): nil pointer deference on h2DictWriter Close() (#154) Unlike other h2DictWriter methods, the Close() method does check whether w.comp is nil. This PR adds a check for non nil compressor before attempting to close Bug: #141 --- h2mux/h2_dictionaries.go | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/h2mux/h2_dictionaries.go b/h2mux/h2_dictionaries.go index bd091894..bf92d58d 100644 --- a/h2mux/h2_dictionaries.go +++ b/h2mux/h2_dictionaries.go @@ -542,7 +542,10 @@ func (w *h2DictWriter) Write(p []byte) (n int, err error) { } func (w *h2DictWriter) Close() error { - return w.comp.Close() + if w.comp != nil { + return w.comp.Close() + } + return nil } // From http2/hpack