Skip to content
This repository was archived by the owner on Apr 10, 2025. It is now read-only.

Commit 60c1f4c

Browse files
committed
Fix valgrind complaint caused by NgxBaseFetch
We should not use r->connection after we finalize the request. Fixes #1100
1 parent d023bb3 commit 60c1f4c

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

src/ngx_base_fetch.cc

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -165,13 +165,15 @@ void NgxBaseFetch::ReadCallback(const ps_event_data& data) {
165165
}
166166

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

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

0 commit comments

Comments
 (0)