From 5ea90ba6bd5b0222369a1eea408de232e977afa3 Mon Sep 17 00:00:00 2001 From: Tatsuhiro Tsujikawa Date: Sat, 12 Sep 2015 02:40:55 +0900 Subject: [PATCH] nghttpx: Fix crash with signal QUIT if mruby is not initialized --- src/shrpx_mruby.cc | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/src/shrpx_mruby.cc b/src/shrpx_mruby.cc index aadca674..974f0004 100644 --- a/src/shrpx_mruby.cc +++ b/src/shrpx_mruby.cc @@ -42,7 +42,11 @@ MRubyContext::MRubyContext(mrb_state *mrb, RProc *on_request_proc, : mrb_(mrb), on_request_proc_(on_request_proc), on_response_proc_(on_response_proc), running_(false) {} -MRubyContext::~MRubyContext() { mrb_close(mrb_); } +MRubyContext::~MRubyContext() { + if (mrb_) { + mrb_close(mrb_); + } +} int MRubyContext::run_request_proc(Downstream *downstream, RProc *proc, int phase) {