From f1a9b58ae3512ce0042e244cd2f86809e6be0148 Mon Sep 17 00:00:00 2001 From: Timo Sirainen Date: Tue, 23 Feb 2016 01:48:47 +0200 Subject: [PATCH] lib-http: Fix to earlier http_client_connection_unref() change 1dead6 Patch by Stephan Bosch --- src/lib-http/http-client-connection.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/lib-http/http-client-connection.c b/src/lib-http/http-client-connection.c index 43c6d1f31c..17f891793a 100644 --- a/src/lib-http/http-client-connection.c +++ b/src/lib-http/http-client-connection.c @@ -571,13 +571,15 @@ http_client_connection_return_response(struct http_client_request *req, conn->in_req_callback = TRUE; http_client_connection_ref(conn); retrying = !http_client_request_callback(req, response); - if (!http_client_connection_unref(&req->conn)) { + if (!http_client_connection_unref(&conn)) { /* the callback managed to get this connection destroyed */ + req->conn = NULL; if (!retrying) http_client_request_finish(req); http_client_request_unref(&req); return FALSE; } + conn = req->conn; conn->in_req_callback = FALSE; if (retrying) {