mirror of
https://github.com/moparisthebest/curl
synced 2024-12-21 23:58:49 -05:00
deal with input arguments as NULL
This commit is contained in:
parent
78aba6e4cd
commit
594cb8507b
10
lib/easy.c
10
lib/easy.c
@ -307,6 +307,9 @@ CURLcode curl_easy_setopt(CURL *curl, CURLoption tag, ...)
|
|||||||
struct SessionHandle *data = curl;
|
struct SessionHandle *data = curl;
|
||||||
CURLcode ret=CURLE_FAILED_INIT;
|
CURLcode ret=CURLE_FAILED_INIT;
|
||||||
|
|
||||||
|
if(!curl)
|
||||||
|
return CURLE_BAD_FUNCTION_ARGUMENT;
|
||||||
|
|
||||||
va_start(arg, tag);
|
va_start(arg, tag);
|
||||||
|
|
||||||
/* PORTING NOTE:
|
/* PORTING NOTE:
|
||||||
@ -348,6 +351,9 @@ CURLcode curl_easy_perform(CURL *curl)
|
|||||||
{
|
{
|
||||||
struct SessionHandle *data = (struct SessionHandle *)curl;
|
struct SessionHandle *data = (struct SessionHandle *)curl;
|
||||||
|
|
||||||
|
if(!data)
|
||||||
|
return CURLE_BAD_FUNCTION_ARGUMENT;
|
||||||
|
|
||||||
if ( ! (data->share && data->share->hostcache) ) {
|
if ( ! (data->share && data->share->hostcache) ) {
|
||||||
|
|
||||||
if (Curl_global_host_cache_use(data) &&
|
if (Curl_global_host_cache_use(data) &&
|
||||||
@ -379,6 +385,10 @@ CURLcode curl_easy_perform(CURL *curl)
|
|||||||
void curl_easy_cleanup(CURL *curl)
|
void curl_easy_cleanup(CURL *curl)
|
||||||
{
|
{
|
||||||
struct SessionHandle *data = (struct SessionHandle *)curl;
|
struct SessionHandle *data = (struct SessionHandle *)curl;
|
||||||
|
|
||||||
|
if(!data)
|
||||||
|
return;
|
||||||
|
|
||||||
if ( ! (data->share && data->share->hostcache) ) {
|
if ( ! (data->share && data->share->hostcache) ) {
|
||||||
if ( !Curl_global_host_cache_use(data)) {
|
if ( !Curl_global_host_cache_use(data)) {
|
||||||
Curl_hash_destroy(data->hostcache);
|
Curl_hash_destroy(data->hostcache);
|
||||||
|
Loading…
Reference in New Issue
Block a user