nghttpx: Fix crash with signal QUIT if mruby is not initialized

This commit is contained in:
Tatsuhiro Tsujikawa 2015-09-12 02:40:55 +09:00
parent fd8067be94
commit 5ea90ba6bd
1 changed files with 5 additions and 1 deletions

View File

@ -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) {