Skip to content

Commit

Permalink
Fix valgrind reported issue in HTTP client
Browse files Browse the repository at this point in the history
check_multi_info is invoked from "http client" and asio contexts.
Calling delete of connection info from here causes problems due to this.
Moving this such that if a new connection is created and if old
connection info is available, it is deleted. The last one is deleted when
HttpConnection is removed. Rechecked valgrind with this fix.

Change-Id: I0d2592b6ddb098d8f86e8036b0c1aa5c979627ac
closes-bug: 1461910
(cherry picked from commit 25d3747)
  • Loading branch information
haripk committed Jun 5, 2015
1 parent 9195b58 commit f029079
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 3 deletions.
4 changes: 4 additions & 0 deletions src/http/client/http_client.cc
Expand Up @@ -202,6 +202,10 @@ void HttpConnection::HttpProcessInternal(const std::string body, std::string pat
return;
}

if (curl_handle_) {
// delete existing curl_handle
del_curl_handle(curl_handle_, gi);
}
curl_handle->connection = this;
set_curl_handle(curl_handle);

Expand Down
3 changes: 0 additions & 3 deletions src/http/client/http_curl.cc
Expand Up @@ -97,9 +97,6 @@ static void check_multi_info(GlobalInfo *g)
std::string empty_str("");
if (conn->connection->HttpClientCb() != NULL)
conn->connection->HttpClientCb()(empty_str, error);

conn->connection->set_curl_handle(NULL);
del_curl_handle(conn, g);
}
}
}
Expand Down

0 comments on commit f029079

Please sign in to comment.