Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

XrdTpc: Fixup some minor memory bugs #1423

Merged
merged 1 commit into from
Mar 10, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
4 changes: 2 additions & 2 deletions src/XrdTpc/XrdTpcMultistream.cc
Original file line number Diff line number Diff line change
Expand Up @@ -263,7 +263,7 @@ class MultiCurlHandler {


int TPCHandler::RunCurlWithStreamsImpl(XrdHttpExtReq &req, State &state,
size_t streams, std::vector<State*> handles, TPCLogRecord &rec)
size_t streams, std::vector<State*> &handles, TPCLogRecord &rec)
{
int result;
bool success;
Expand Down Expand Up @@ -358,8 +358,8 @@ int TPCHandler::RunCurlWithStreamsImpl(XrdHttpExtReq &req, State &state,
msg = curl_multi_info_read(multi_handle, &msgq);
if (msg && (msg->msg == CURLMSG_DONE)) {
CURL *easy_handle = msg->easy_handle;
mch.FinishCurlXfer(easy_handle);
res = msg->data.result;
mch.FinishCurlXfer(easy_handle);
// If any requests fail, cut off the entire transfer.
if (res != CURLE_OK) {
break;
Expand Down
6 changes: 3 additions & 3 deletions src/XrdTpc/XrdTpcTPC.cc
Original file line number Diff line number Diff line change
Expand Up @@ -610,14 +610,14 @@ int TPCHandler::ProcessPushReq(const std::string & resource, XrdHttpExtReq &req)
if (name) rec.name = name;
logTransferEvent(LogMask::Info, rec, "PUSH_START", "Starting a push request");
CURL *curl = curl_easy_init();
curl_easy_setopt(curl, CURLOPT_NOSIGNAL, 1);
if (!curl) {
char msg[] = "Failed to initialize internal transfer resources";
rec.status = 500;
logTransferEvent(LogMask::Error, rec, "PUSH_FAIL", msg);
return req.SendSimpleResp(rec.status, NULL, NULL, msg, 0);
}

curl_easy_setopt(curl, CURLOPT_NOSIGNAL, 1);

auto query_header = req.headers.find("xrd-http-fullresource");
std::string redirect_resource = req.resource;
if (query_header != req.headers.end()) {
Expand Down Expand Up @@ -686,13 +686,13 @@ int TPCHandler::ProcessPullReq(const std::string &resource, XrdHttpExtReq &req)
if (name) rec.name = name;
logTransferEvent(LogMask::Info, rec, "PULL_START", "Starting a push request");
CURL *curl = curl_easy_init();
curl_easy_setopt(curl, CURLOPT_NOSIGNAL, 1);
if (!curl) {
char msg[] = "Failed to initialize internal transfer resources";
rec.status = 500;
logTransferEvent(LogMask::Error, rec, "PULL_FAIL", msg);
return req.SendSimpleResp(rec.status, NULL, NULL, msg, 0);
}
curl_easy_setopt(curl, CURLOPT_NOSIGNAL, 1);
std::unique_ptr<XrdSfsFile> fh(m_sfs->newFile(name, m_monid++));
if (!fh.get()) {
curl_easy_cleanup(curl);
Expand Down
2 changes: 1 addition & 1 deletion src/XrdTpc/XrdTpcTPC.hh
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,7 @@ private:
int RunCurlWithStreams(XrdHttpExtReq &req, TPC::State &state,
size_t streams, TPCLogRecord &rec);
int RunCurlWithStreamsImpl(XrdHttpExtReq &req, TPC::State &state,
size_t streams, std::vector<TPC::State*> streams_handles,
size_t streams, std::vector<TPC::State*> &streams_handles,
TPCLogRecord &rec);
#else
int RunCurlBasic(CURL *curl, XrdHttpExtReq &req, TPC::State &state,
Expand Down