From 103de9c164934b2393dfcba7011625f90c8a2097 Mon Sep 17 00:00:00 2001 From: George Hazan Date: Wed, 24 Jul 2019 14:30:13 +0300 Subject: NLHR_PTR - smart pointers make better code --- plugins/PluginUpdater/src/Utils.cpp | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) (limited to 'plugins/PluginUpdater/src') diff --git a/plugins/PluginUpdater/src/Utils.cpp b/plugins/PluginUpdater/src/Utils.cpp index f6d23f1899..321ce1bd71 100644 --- a/plugins/PluginUpdater/src/Utils.cpp +++ b/plugins/PluginUpdater/src/Utils.cpp @@ -258,7 +258,7 @@ bool DownloadFile(FILEURL *pFileURL, HNETLIBCONN &nlc) bool ret = false; for (int i = 0; !ret && i < MAX_RETRIES; i++) { Netlib_LogfW(hNetlibUser,L"Downloading file %s to %s (attempt %d)",pFileURL->tszDownloadURL,pFileURL->tszDiskPath, i+1); - NETLIBHTTPREQUEST *pReply = Netlib_HttpTransaction(hNetlibUser, &nlhr); + NLHR_PTR pReply(Netlib_HttpTransaction(hNetlibUser, &nlhr)); if (pReply) { nlc = pReply->nlc; if ((200 == pReply->resultCode) && (pReply->dataLength > 0)) { @@ -269,7 +269,6 @@ bool DownloadFile(FILEURL *pFileURL, HNETLIBCONN &nlc) if (crc != pFileURL->CRCsum) { // crc check failed, try again Netlib_LogfW(hNetlibUser,L"crc check failed for file %s",pFileURL->tszDiskPath); - Netlib_FreeHttpRequest(pReply); continue; } } @@ -296,8 +295,6 @@ bool DownloadFile(FILEURL *pFileURL, HNETLIBCONN &nlc) ret = true; } else Netlib_LogfW(hNetlibUser,L"Downloading file %s failed with error %d",pFileURL->tszDownloadURL,pReply->resultCode); - - Netlib_FreeHttpRequest(pReply); } else { Netlib_LogfW(hNetlibUser,L"Downloading file %s failed, host is propably temporary down.",pFileURL->tszDownloadURL); -- cgit v1.2.3