diff options
author | George Hazan <ghazan@miranda.im> | 2019-07-24 14:30:13 +0300 |
---|---|---|
committer | George Hazan <ghazan@miranda.im> | 2019-07-24 14:30:13 +0300 |
commit | 103de9c164934b2393dfcba7011625f90c8a2097 (patch) | |
tree | f7a4a09afe29398f3b7605d7d0db264638a18150 /protocols/FacebookRM/src | |
parent | 541eab20530165d10592a9fda590f435c6a8b4be (diff) |
NLHR_PTR - smart pointers make better code
Diffstat (limited to 'protocols/FacebookRM/src')
-rw-r--r-- | protocols/FacebookRM/src/communication.cpp | 8 |
1 files changed, 2 insertions, 6 deletions
diff --git a/protocols/FacebookRM/src/communication.cpp b/protocols/FacebookRM/src/communication.cpp index a7e59ef64b..7d0dfaa86f 100644 --- a/protocols/FacebookRM/src/communication.cpp +++ b/protocols/FacebookRM/src/communication.cpp @@ -79,7 +79,7 @@ http::response facebook_client::sendRequest(HttpRequest *request) parent->debugLogA("@@@ Sending request to '%s'", request->m_szUrl.c_str()); // Send the request - NETLIBHTTPREQUEST *pnlhr = request->Send(handle_); + NLHR_PTR pnlhr(request->Send(handle_)); // Remember the persistent connection handle (or not) switch (request->Persistent) { @@ -103,8 +103,6 @@ http::response facebook_client::sendRequest(HttpRequest *request) store_headers(&resp, pnlhr->headers, pnlhr->headersCount); resp.code = pnlhr->resultCode; resp.data = pnlhr->pData ? pnlhr->pData : ""; - - Netlib_FreeHttpRequest(pnlhr); } else { parent->debugLogA("!!! No response from server (time-out)"); @@ -1114,7 +1112,7 @@ bool facebook_client::save_url(const std::string &url, const std::wstring &filen req.nlc = nlc; bool ret = false; - NETLIBHTTPREQUEST *resp = Netlib_HttpTransaction(handle_, &req); + NLHR_PTR resp(Netlib_HttpTransaction(handle_, &req)); if (resp) { nlc = resp->nlc; parent->debugLogA("@@@ Saving URL %s to file %s", url.c_str(), _T2A(filename.c_str())); @@ -1132,8 +1130,6 @@ bool facebook_client::save_url(const std::string &url, const std::wstring &filen ret = _waccess(filename.c_str(), 0) == 0; } - - Netlib_FreeHttpRequest(resp); } else nlc = nullptr; |