Fix valgrind complaint caused by NgxBaseFetch
We should not use r->connection after we finalize the request. Fixes https://github.com/pagespeed/ngx_pagespeed/issues/1100
This commit is contained in:
@@ -165,6 +165,7 @@ void NgxBaseFetch::ReadCallback(const ps_event_data& data) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
int rc;
|
int rc;
|
||||||
|
bool run_posted = true;
|
||||||
// If we are unlucky enough to have our connection finalized mid-ipro-lookup,
|
// 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().
|
// we must enter a different flow. Also see ps_in_place_check_header_filter().
|
||||||
if ((ctx->base_fetch->base_fetch_type_ != kIproLookup)
|
if ((ctx->base_fetch->base_fetch_type_ != kIproLookup)
|
||||||
@@ -172,6 +173,7 @@ void NgxBaseFetch::ReadCallback(const ps_event_data& data) {
|
|||||||
ngx_log_error(NGX_LOG_DEBUG, ngx_cycle->log, 0,
|
ngx_log_error(NGX_LOG_DEBUG, ngx_cycle->log, 0,
|
||||||
"pagespeed [%p] request already finalized %d", r, r->count);
|
"pagespeed [%p] request already finalized %d", r, r->count);
|
||||||
rc = NGX_ERROR;
|
rc = NGX_ERROR;
|
||||||
|
run_posted = false;
|
||||||
} else {
|
} else {
|
||||||
rc = ps_base_fetch::ps_base_fetch_handler(r);
|
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_connection_t* c = r->connection;
|
||||||
ngx_http_finalize_request(r, rc);
|
ngx_http_finalize_request(r, rc);
|
||||||
|
|
||||||
if (!r->connection->error) {
|
if (run_posted) {
|
||||||
// See http://forum.nginx.org/read.php?2,253006,253061
|
// See http://forum.nginx.org/read.php?2,253006,253061
|
||||||
ngx_http_run_posted_requests(c);
|
ngx_http_run_posted_requests(c);
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user