diff options
author | Daniel Stenberg <daniel@haxx.se> | 2012-06-15 22:37:19 +0200 |
---|---|---|
committer | Daniel Stenberg <daniel@haxx.se> | 2012-06-15 22:37:19 +0200 |
commit | 3da2c0f6d231dabcf0f4402eadc14d954b88a858 (patch) | |
tree | 54a1a7ba3c011e243aab1ded95be75133d634e4c /lib/share.c | |
parent | ac3e356c95b3867b96070da2f85022b6280921d1 (diff) | |
download | curl-3da2c0f6d231dabcf0f4402eadc14d954b88a858.tar.gz |
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.
Diffstat (limited to 'lib/share.c')
-rw-r--r-- | lib/share.c | 36 |
1 files changed, 21 insertions, 15 deletions
diff --git a/lib/share.c b/lib/share.c index 839b33e60..477c35b0b 100644 --- a/lib/share.c +++ b/lib/share.c @@ -51,6 +51,7 @@ curl_share_setopt(CURLSH *sh, CURLSHoption option, ...) curl_lock_function lockfunc; curl_unlock_function unlockfunc; void *ptr; + CURLSHcode res = CURLSHE_OK; if(share->dirty) /* 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) { share->hostcache = Curl_mk_dnscache(); if(!share->hostcache) - return CURLSHE_NOMEM; + res = CURLSHE_NOMEM; } break; @@ -78,12 +79,12 @@ curl_share_setopt(CURLSH *sh, CURLSHoption option, ...) if(!share->cookies) { share->cookies = Curl_cookie_init(NULL, NULL, NULL, TRUE ); if(!share->cookies) - return CURLSHE_NOMEM; + res = CURLSHE_NOMEM; } - break; #else /* CURL_DISABLE_HTTP */ - return CURLSHE_NOT_BUILT_IN; + res = CURLSHE_NOT_BUILT_IN; #endif + break; case CURL_LOCK_DATA_SSL_SESSION: #ifdef USE_SSL @@ -93,17 +94,18 @@ curl_share_setopt(CURLSH *sh, CURLSHoption option, ...) sizeof(struct curl_ssl_session)); share->sessionage = 0; if(!share->sslsession) - return CURLSHE_NOMEM; + res = CURLSHE_NOMEM; } - break; #else - return CURLSHE_NOT_BUILT_IN; + res = CURLSHE_NOT_BUILT_IN; #endif + break; case CURL_LOCK_DATA_CONNECT: /* not supported (yet) */ + break; default: - return CURLSHE_BAD_OPTION; + res = CURLSHE_BAD_OPTION; } break; @@ -125,24 +127,25 @@ curl_share_setopt(CURLSH *sh, CURLSHoption option, ...) Curl_cookie_cleanup(share->cookies); share->cookies = NULL; } - break; #else /* CURL_DISABLE_HTTP */ - return CURLSHE_NOT_BUILT_IN; + res = CURLSHE_NOT_BUILT_IN; #endif + break; case CURL_LOCK_DATA_SSL_SESSION: #ifdef USE_SSL Curl_safefree(share->sslsession); - break; #else - return CURLSHE_NOT_BUILT_IN; + res = CURLSHE_NOT_BUILT_IN; #endif + break; case CURL_LOCK_DATA_CONNECT: break; default: - return CURLSHE_BAD_OPTION; + res = CURLSHE_BAD_OPTION; + break; } break; @@ -162,10 +165,13 @@ curl_share_setopt(CURLSH *sh, CURLSHoption option, ...) break; default: - return CURLSHE_BAD_OPTION; + res = CURLSHE_BAD_OPTION; + break; } - return CURLSHE_OK; + va_end(param); + + return res; } CURLSHcode |