From b55514c390b22605fabdf3a8e5011415f57e6da8 Mon Sep 17 00:00:00 2001 From: Yehuda Sadeh Date: Tue, 3 May 2016 12:00:46 -0700 Subject: [PATCH] rgw: RGWHTTPManager, avoid referring to req_data->client when completing this is past calling req_data->finish(), client can be destroyed by now Signed-off-by: Yehuda Sadeh (cherry picked from commit 7ada4df124a71eae413e7dec0e25264a8deffcad) --- src/rgw/rgw_http_client.cc | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/src/rgw/rgw_http_client.cc b/src/rgw/rgw_http_client.cc index 17edea2d0f090..93edd1f4f6890 100644 --- a/src/rgw/rgw_http_client.cc +++ b/src/rgw/rgw_http_client.cc @@ -138,13 +138,15 @@ struct rgw_http_req_data : public RefCountedObject { int ret; atomic_t done; RGWHTTPClient *client; + void *user_info; RGWHTTPManager *mgr; char error_buf[CURL_ERROR_SIZE]; Mutex lock; Cond cond; - rgw_http_req_data() : easy_handle(NULL), h(NULL), id(-1), ret(0), client(NULL), + rgw_http_req_data() : easy_handle(NULL), h(NULL), id(-1), ret(0), + client(nullptr), user_info(nullptr), mgr(NULL), lock("rgw_http_req_data::lock") { memset(error_buf, 0, sizeof(error_buf)); } @@ -386,7 +388,7 @@ void RGWHTTPManager::_complete_request(rgw_http_req_data *req_data) reqs.erase(iter); } if (completion_mgr) { - completion_mgr->complete(NULL, req_data->client->get_user_info()); + completion_mgr->complete(NULL, req_data->user_info); } req_data->put(); } @@ -461,6 +463,7 @@ int RGWHTTPManager::add_request(RGWHTTPClient *client, const char *method, const req_data->mgr = this; req_data->client = client; + req_data->user_info = client->get_user_info(); register_request(req_data); -- 2.39.5