Permalink
Browse files

Fix valgrind complaint caused by NgxBaseFetch

We should not use r->connection after we finalize the request.

Fixes #1100
  • Loading branch information...
oschaaf committed Jan 22, 2016
1 parent d023bb3 commit 60c1f4cc4e58493be12e2c5861a5eb6aafb752c6
Showing with 3 additions and 1 deletion.
  1. +3 −1 src/ngx_base_fetch.cc
@@ -165,13 +165,15 @@ void NgxBaseFetch::ReadCallback(const ps_event_data& data) {
}

int rc;
bool run_posted = true;
// If we are unlucky enough to have our connection finalized mid-ipro-lookup,
// we must enter a different flow. Also see ps_in_place_check_header_filter().
if ((ctx->base_fetch->base_fetch_type_ != kIproLookup)
&& r->connection->error) {
ngx_log_error(NGX_LOG_DEBUG, ngx_cycle->log, 0,
"pagespeed [%p] request already finalized %d", r, r->count);
rc = NGX_ERROR;
run_posted = false;
} else {
rc = ps_base_fetch::ps_base_fetch_handler(r);
}
@@ -185,7 +187,7 @@ void NgxBaseFetch::ReadCallback(const ps_event_data& data) {
ngx_connection_t* c = r->connection;
ngx_http_finalize_request(r, rc);

if (!r->connection->error) {
if (run_posted) {
// See http://forum.nginx.org/read.php?2,253006,253061
ngx_http_run_posted_requests(c);
}

0 comments on commit 60c1f4c

Please sign in to comment.