(_kdc_do_524): Handle memory allocation failure

Coverity, NetBSD CID#2752


git-svn-id: svn://svn.h5l.se/heimdal/trunk/heimdal@17015 ec53bebd-3082-4978-b11e-865c3cabbd6b
This commit is contained in:
Love Hörnquist Åstrand
2006-04-07 22:12:28 +00:00
parent 2a6831b56c
commit 8f297fdb5c

View File

@@ -374,19 +374,21 @@ _kdc_do_524(krb5_context context,
/* make reply */ /* make reply */
memset(buf, 0, sizeof(buf)); memset(buf, 0, sizeof(buf));
sp = krb5_storage_from_mem(buf, sizeof(buf)); sp = krb5_storage_from_mem(buf, sizeof(buf));
krb5_store_int32(sp, ret); if (sp) {
if(ret == 0){ krb5_store_int32(sp, ret);
krb5_store_int32(sp, kvno); if(ret == 0){
krb5_store_data(sp, ticket.cipher); krb5_store_int32(sp, kvno);
/* Aargh! This is coded as a KTEXT_ST. */ krb5_store_data(sp, ticket.cipher);
krb5_storage_seek(sp, MAX_KTXT_LEN - ticket.cipher.length, SEEK_CUR); /* Aargh! This is coded as a KTEXT_ST. */
krb5_store_int32(sp, 0); /* mbz */ krb5_storage_seek(sp, MAX_KTXT_LEN - ticket.cipher.length, SEEK_CUR);
free_EncryptedData(&ticket); krb5_store_int32(sp, 0); /* mbz */
} free_EncryptedData(&ticket);
ret = krb5_storage_to_data(sp, reply); }
reply->length = krb5_storage_seek(sp, 0, SEEK_CUR); ret = krb5_storage_to_data(sp, reply);
krb5_storage_free(sp); reply->length = krb5_storage_seek(sp, 0, SEEK_CUR);
krb5_storage_free(sp);
} else
krb5_data_zero(reply);
if(spn) if(spn)
free(spn); free(spn);
if(server) if(server)