{
krb5_error_code retval;
krb5_address ** tempaddr;
- register int nelems;
+ register int nelems = 0;
- for (nelems = 0; inaddr[nelems]; nelems++);
+ while (inaddr[nelems]) nelems++;
/* one more for a null terminated list */
if (!(tempaddr = (krb5_address **) calloc(nelems+1, sizeof(*tempaddr))))
return ENOMEM;
for (nelems = 0; inaddr[nelems]; nelems++)
- if (retval = krb5_copy_addr(inaddr[nelems], &tempaddr[nelems])) {
+ retval = krb5_copy_addr(inaddr[nelems], &tempaddr[nelems]);
+ if (retval) {
krb5_free_addresses(tempaddr);
return retval;
}
krb5_error_code retval;
krb5_address ** tempaddr;
krb5_address ** tempaddr2;
- register int nelems;
- register int norigelems;
+ register int nelems = 0;
+ register int norigelems = 0;
if (!inaddr)
return 0;
tempaddr2 = *outaddr;
- for (nelems = 0; inaddr[nelems]; nelems++);
- for (norigelems = 0; tempaddr2[norigelems]; norigelems++);
+ while (inaddr[nelems]) nelems++;
+ while (tempaddr2[norigelems]) norigelems++;
tempaddr = realloc((char *)*outaddr,
(nelems + norigelems + 1) * sizeof(*tempaddr));
*outaddr = tempaddr;
- for (nelems = 0; inaddr[nelems]; nelems++)
- if (retval = krb5_copy_addr(inaddr[nelems],
- &tempaddr[norigelems + nelems]))
+ for (nelems = 0; inaddr[nelems]; nelems++) {
+ retval = krb5_copy_addr(inaddr[nelems],
+ &tempaddr[norigelems + nelems]);
+ if (retval)
goto cleanup;
+ }
tempaddr[norigelems + nelems] = 0;
return 0;
return ENOMEM;
*tempto = *authfrom;
- if (retval = krb5_copy_principal(authfrom->client, &tempto->client)) {
+ retval = krb5_copy_principal(authfrom->client, &tempto->client);
+ if (retval) {
xfree(tempto);
return retval;
}
}
if (authfrom->subkey) {
- if (retval = krb5_copy_keyblock(authfrom->subkey,
- &tempto->subkey)) {
+ retval = krb5_copy_keyblock(authfrom->subkey, &tempto->subkey);
+ if (retval) {
xfree(tempto->subkey);
krb5_free_checksum(tempto->checksum);
krb5_free_principal(tempto->client);
{
krb5_error_code retval;
krb5_authdata ** tempauthdat;
- register int nelems;
+ register int nelems = 0;
- for (nelems = 0; inauthdat[nelems]; nelems++);
+ while (inauthdat[nelems]) nelems++;
/* one more for a null terminated list */
if (!(tempauthdat = (krb5_authdata **) calloc(nelems+1,
sizeof(*tempauthdat))))
return ENOMEM;
- for (nelems = 0; inauthdat[nelems]; nelems++)
- if (retval = krb5_copy_authdatum(inauthdat[nelems],
- &tempauthdat[nelems])) {
+ for (nelems = 0; inauthdat[nelems]; nelems++) {
+ retval = krb5_copy_authdatum(inauthdat[nelems],
+ &tempauthdat[nelems]);
+ if (retval) {
krb5_free_authdata(tempauthdat);
return retval;
}
+ }
*outauthdat = tempauthdat;
return 0;
return ENOMEM;
*tempcred = *incred; /* copy everything quickly */
- if (retval = krb5_copy_principal(incred->client, &tempcred->client))
+ retval = krb5_copy_principal(incred->client, &tempcred->client);
+ if (retval)
goto cleanlast;
- if (retval = krb5_copy_principal(incred->server, &tempcred->server))
+ retval = krb5_copy_principal(incred->server, &tempcred->server);
+ if (retval)
goto cleanclient;
- if (retval = krb5_copy_keyblock_contents(&incred->keyblock,
- &tempcred->keyblock))
+ retval = krb5_copy_keyblock_contents(&incred->keyblock,
+ &tempcred->keyblock);
+ if (retval)
goto cleanserver;
- if (retval = krb5_copy_addresses(incred->addresses, &tempcred->addresses))
+ retval = krb5_copy_addresses(incred->addresses, &tempcred->addresses);
+ if (retval)
goto cleanblock;
- if (retval = krb5_copy_data(&incred->ticket, &scratch))
+ retval = krb5_copy_data(&incred->ticket, &scratch);
+ if (retval)
goto cleanaddrs;
tempcred->ticket = *scratch;
xfree(scratch);
- if (retval = krb5_copy_data(&incred->second_ticket,
- &scratch))
+ retval = krb5_copy_data(&incred->second_ticket, &scratch);
+ if (retval)
goto cleanticket;
tempcred->second_ticket = *scratch;