Repository: trafficserver Updated Branches: refs/heads/master b975cb24b -> b3fab3619
TS-3984 - Missing NULL checks in HttpSM::handler_server_setup_error. Project: http://git-wip-us.apache.org/repos/asf/trafficserver/repo Commit: http://git-wip-us.apache.org/repos/asf/trafficserver/commit/b3fab361 Tree: http://git-wip-us.apache.org/repos/asf/trafficserver/tree/b3fab361 Diff: http://git-wip-us.apache.org/repos/asf/trafficserver/diff/b3fab361 Branch: refs/heads/master Commit: b3fab36196dc143283364b56b0db802e4dd81bad Parents: b975cb2 Author: shinrich <shinr...@yahoo-inc.com> Authored: Tue Oct 6 14:00:44 2015 -0500 Committer: shinrich <shinr...@yahoo-inc.com> Committed: Tue Oct 6 14:00:44 2015 -0500 ---------------------------------------------------------------------- proxy/http/HttpSM.cc | 24 +++++++++++++++--------- 1 file changed, 15 insertions(+), 9 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/trafficserver/blob/b3fab361/proxy/http/HttpSM.cc ---------------------------------------------------------------------- diff --git a/proxy/http/HttpSM.cc b/proxy/http/HttpSM.cc index 2889ef3..02b4ff3 100644 --- a/proxy/http/HttpSM.cc +++ b/proxy/http/HttpSM.cc @@ -5217,18 +5217,24 @@ HttpSM::handle_server_setup_error(int event, void *data) c = tunnel.get_consumer(post_transform_info.vc); // c->handler_state = HTTP_SM_TRANSFORM_FAIL; - HttpTunnelProducer *ua_producer = c->producer; - ink_assert(ua_entry->vc == ua_producer->vc); + // No point in proceeding if there is no consumer + // Do we need to do additional clean up in the c == NULL case? + if (c != NULL) { + HttpTunnelProducer *ua_producer = c->producer; + ink_assert(ua_entry->vc == ua_producer->vc); - ua_entry->vc_handler = &HttpSM::state_watch_for_client_abort; - ua_entry->read_vio = ua_producer->vc->do_io_read(this, INT64_MAX, c->producer->read_buffer); - ua_producer->vc->do_io_shutdown(IO_SHUTDOWN_READ); + ua_entry->vc_handler = &HttpSM::state_watch_for_client_abort; + ua_entry->read_vio = ua_producer->vc->do_io_read(this, INT64_MAX, c->producer->read_buffer); + ua_producer->vc->do_io_shutdown(IO_SHUTDOWN_READ); - ua_producer->alive = false; - ua_producer->handler_state = HTTP_SM_POST_SERVER_FAIL; - tunnel.handleEvent(VC_EVENT_ERROR, c->write_vio); + ua_producer->alive = false; + ua_producer->handler_state = HTTP_SM_POST_SERVER_FAIL; + tunnel.handleEvent(VC_EVENT_ERROR, c->write_vio); + } } else { - tunnel.handleEvent(event, c->write_vio); + // c could be null here as well + if (c != NULL) + tunnel.handleEvent(event, c->write_vio); } return; } else {