* ipa_pwd_extop.c (encrypt_encode_key): Handle malloc failure.

This commit is contained in:
Jim Meyering 2008-05-14 11:03:52 +02:00 committed by Simo Sorce
parent d0f0d97be6
commit 3256365277

View File

@ -582,6 +582,11 @@ static Slapi_Value **encrypt_encode_key(krb5_context krbctx, struct ipapwd_data
if (krbTicketFlags & KTF_REQUIRES_PRE_AUTH) { if (krbTicketFlags & KTF_REQUIRES_PRE_AUTH) {
salt.length = KRB5P_SALT_SIZE; salt.length = KRB5P_SALT_SIZE;
salt.data = malloc(KRB5P_SALT_SIZE); salt.data = malloc(KRB5P_SALT_SIZE);
if (!salt.data) {
slapi_log_error(SLAPI_LOG_FATAL, "ipa_pwd_extop",
"memory allocation failed\n");
goto enc_error;
}
krberr = krb5_c_random_make_octets(krbctx, &salt); krberr = krb5_c_random_make_octets(krbctx, &salt);
if (krberr) { if (krberr) {
slapi_log_error(SLAPI_LOG_FATAL, "ipa_pwd_extop", slapi_log_error(SLAPI_LOG_FATAL, "ipa_pwd_extop",