From: xb.teng Date: Wed, 26 Dec 2018 02:25:37 +0000 (+0800) Subject: Add protect code for curl handle X-Git-Tag: dali_1.4.7~1^2 X-Git-Url: http://review.tizen.org/git/?p=platform%2Fcore%2Fuifw%2Fdali-adaptor.git;a=commitdiff_plain;h=57163904547cd20b5c89bb959f75fdcf9fc5fd3d Add protect code for curl handle Change-Id: Iaad83802dcc45395759a1b08702d60d10de5b6bc --- diff --git a/dali/internal/imaging/common/file-download.cpp b/dali/internal/imaging/common/file-download.cpp index 965226d..e384a50 100755 --- a/dali/internal/imaging/common/file-download.cpp +++ b/dali/internal/imaging/common/file-download.cpp @@ -287,6 +287,8 @@ bool DownloadRemoteFileIntoMemory( const std::string& url, size_t& dataSize, size_t maximumAllowedSizeBytes ) { + bool result = false; + if( url.empty() ) { DALI_LOG_WARNING("empty url requested \n"); @@ -297,17 +299,18 @@ bool DownloadRemoteFileIntoMemory( const std::string& url, // thread we need to explicity call curl_global_init() on startup from a single thread. CURL* curlHandle = curl_easy_init(); + if ( curlHandle ) + { + result = DownloadFile( curlHandle, url, dataBuffer, dataSize, maximumAllowedSizeBytes); - bool result = DownloadFile( curlHandle, url, dataBuffer, dataSize, maximumAllowedSizeBytes); - - // clean up session - curl_easy_cleanup( curlHandle ); + // clean up session + curl_easy_cleanup( curlHandle ); #ifdef TPK_CURL_ENABLED - // Clean up tpkp(the module for certificate pinning) resources on Tizen - tpkp_curl_cleanup(); + // Clean up tpkp(the module for certificate pinning) resources on Tizen + tpkp_curl_cleanup(); #endif // TPK_CURL_ENABLED - + } return result; }