mirror of
https://github.com/moparisthebest/curl
synced 2024-12-21 23:58:49 -05:00
curl_share_setopt: use va_end()
As spotted by Coverity, va_end() was not used previously. To make it used I took away a bunch of return statements and made them into assignments instead.
This commit is contained in:
parent
ac3e356c95
commit
3da2c0f6d2
36
lib/share.c
36
lib/share.c
@ -51,6 +51,7 @@ curl_share_setopt(CURLSH *sh, CURLSHoption option, ...)
|
|||||||
curl_lock_function lockfunc;
|
curl_lock_function lockfunc;
|
||||||
curl_unlock_function unlockfunc;
|
curl_unlock_function unlockfunc;
|
||||||
void *ptr;
|
void *ptr;
|
||||||
|
CURLSHcode res = CURLSHE_OK;
|
||||||
|
|
||||||
if(share->dirty)
|
if(share->dirty)
|
||||||
/* don't allow setting options while one or more handles are already
|
/* don't allow setting options while one or more handles are already
|
||||||
@ -69,7 +70,7 @@ curl_share_setopt(CURLSH *sh, CURLSHoption option, ...)
|
|||||||
if(!share->hostcache) {
|
if(!share->hostcache) {
|
||||||
share->hostcache = Curl_mk_dnscache();
|
share->hostcache = Curl_mk_dnscache();
|
||||||
if(!share->hostcache)
|
if(!share->hostcache)
|
||||||
return CURLSHE_NOMEM;
|
res = CURLSHE_NOMEM;
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
|
||||||
@ -78,12 +79,12 @@ curl_share_setopt(CURLSH *sh, CURLSHoption option, ...)
|
|||||||
if(!share->cookies) {
|
if(!share->cookies) {
|
||||||
share->cookies = Curl_cookie_init(NULL, NULL, NULL, TRUE );
|
share->cookies = Curl_cookie_init(NULL, NULL, NULL, TRUE );
|
||||||
if(!share->cookies)
|
if(!share->cookies)
|
||||||
return CURLSHE_NOMEM;
|
res = CURLSHE_NOMEM;
|
||||||
}
|
}
|
||||||
break;
|
|
||||||
#else /* CURL_DISABLE_HTTP */
|
#else /* CURL_DISABLE_HTTP */
|
||||||
return CURLSHE_NOT_BUILT_IN;
|
res = CURLSHE_NOT_BUILT_IN;
|
||||||
#endif
|
#endif
|
||||||
|
break;
|
||||||
|
|
||||||
case CURL_LOCK_DATA_SSL_SESSION:
|
case CURL_LOCK_DATA_SSL_SESSION:
|
||||||
#ifdef USE_SSL
|
#ifdef USE_SSL
|
||||||
@ -93,17 +94,18 @@ curl_share_setopt(CURLSH *sh, CURLSHoption option, ...)
|
|||||||
sizeof(struct curl_ssl_session));
|
sizeof(struct curl_ssl_session));
|
||||||
share->sessionage = 0;
|
share->sessionage = 0;
|
||||||
if(!share->sslsession)
|
if(!share->sslsession)
|
||||||
return CURLSHE_NOMEM;
|
res = CURLSHE_NOMEM;
|
||||||
}
|
}
|
||||||
break;
|
|
||||||
#else
|
#else
|
||||||
return CURLSHE_NOT_BUILT_IN;
|
res = CURLSHE_NOT_BUILT_IN;
|
||||||
#endif
|
#endif
|
||||||
|
break;
|
||||||
|
|
||||||
case CURL_LOCK_DATA_CONNECT: /* not supported (yet) */
|
case CURL_LOCK_DATA_CONNECT: /* not supported (yet) */
|
||||||
|
break;
|
||||||
|
|
||||||
default:
|
default:
|
||||||
return CURLSHE_BAD_OPTION;
|
res = CURLSHE_BAD_OPTION;
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
|
||||||
@ -125,24 +127,25 @@ curl_share_setopt(CURLSH *sh, CURLSHoption option, ...)
|
|||||||
Curl_cookie_cleanup(share->cookies);
|
Curl_cookie_cleanup(share->cookies);
|
||||||
share->cookies = NULL;
|
share->cookies = NULL;
|
||||||
}
|
}
|
||||||
break;
|
|
||||||
#else /* CURL_DISABLE_HTTP */
|
#else /* CURL_DISABLE_HTTP */
|
||||||
return CURLSHE_NOT_BUILT_IN;
|
res = CURLSHE_NOT_BUILT_IN;
|
||||||
#endif
|
#endif
|
||||||
|
break;
|
||||||
|
|
||||||
case CURL_LOCK_DATA_SSL_SESSION:
|
case CURL_LOCK_DATA_SSL_SESSION:
|
||||||
#ifdef USE_SSL
|
#ifdef USE_SSL
|
||||||
Curl_safefree(share->sslsession);
|
Curl_safefree(share->sslsession);
|
||||||
break;
|
|
||||||
#else
|
#else
|
||||||
return CURLSHE_NOT_BUILT_IN;
|
res = CURLSHE_NOT_BUILT_IN;
|
||||||
#endif
|
#endif
|
||||||
|
break;
|
||||||
|
|
||||||
case CURL_LOCK_DATA_CONNECT:
|
case CURL_LOCK_DATA_CONNECT:
|
||||||
break;
|
break;
|
||||||
|
|
||||||
default:
|
default:
|
||||||
return CURLSHE_BAD_OPTION;
|
res = CURLSHE_BAD_OPTION;
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
|
||||||
@ -162,10 +165,13 @@ curl_share_setopt(CURLSH *sh, CURLSHoption option, ...)
|
|||||||
break;
|
break;
|
||||||
|
|
||||||
default:
|
default:
|
||||||
return CURLSHE_BAD_OPTION;
|
res = CURLSHE_BAD_OPTION;
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
return CURLSHE_OK;
|
va_end(param);
|
||||||
|
|
||||||
|
return res;
|
||||||
}
|
}
|
||||||
|
|
||||||
CURLSHcode
|
CURLSHcode
|
||||||
|
Loading…
Reference in New Issue
Block a user