security:choose_mech fix DEAD CODE warning

... by removing the "do {} while (0)" block.

Coverity CID 1306669
This commit is contained in:
Daniel Stenberg 2015-06-15 08:57:31 +02:00
parent 45bad4ac97
commit 99eafc49bb

View File

@ -480,7 +480,6 @@ static CURLcode choose_mech(struct connectdata *conn)
void *tmp_allocation; void *tmp_allocation;
const struct Curl_sec_client_mech *mech = &Curl_krb5_client_mech; const struct Curl_sec_client_mech *mech = &Curl_krb5_client_mech;
do {
tmp_allocation = realloc(conn->app_data, mech->size); tmp_allocation = realloc(conn->app_data, mech->size);
if(tmp_allocation == NULL) { if(tmp_allocation == NULL) {
failf(data, "Failed realloc of size %u", mech->size); failf(data, "Failed realloc of size %u", mech->size);
@ -494,7 +493,7 @@ static CURLcode choose_mech(struct connectdata *conn)
if(ret) { if(ret) {
infof(data, "Failed initialization for %s. Skipping it.\n", infof(data, "Failed initialization for %s. Skipping it.\n",
mech->name); mech->name);
continue; return CURLE_FAILED_INIT;
} }
} }
@ -521,15 +520,14 @@ static CURLcode choose_mech(struct connectdata *conn)
} }
break; break;
} }
continue; return CURLE_LOGIN_DENIED;
} }
/* Authenticate */ /* Authenticate */
ret = mech->auth(conn->app_data, conn); ret = mech->auth(conn->app_data, conn);
if(ret == AUTH_CONTINUE) if(ret != AUTH_CONTINUE) {
continue; if(ret != AUTH_OK) {
else if(ret != AUTH_OK) {
/* Mechanism has dumped the error to stderr, don't error here. */ /* Mechanism has dumped the error to stderr, don't error here. */
return -1; return -1;
} }
@ -545,8 +543,7 @@ static CURLcode choose_mech(struct connectdata *conn)
/* Set the requested protection level */ /* Set the requested protection level */
/* BLOCKING */ /* BLOCKING */
(void)sec_set_protection_level(conn); (void)sec_set_protection_level(conn);
}
} WHILE_FALSE;
return CURLE_OK; return CURLE_OK;
} }