From: Tom Yu Date: Mon, 5 Dec 2011 23:43:17 +0000 (+0000) Subject: pull up r25496 from trunk X-Git-Tag: krb5-1.10-alpha2~11 X-Git-Url: http://git.tremily.us/?a=commitdiff_plain;h=ce84a530f426e6c5f00abd3f171ec895921d6c18;p=krb5.git pull up r25496 from trunk ------------------------------------------------------------------------ r25496 | hartmans | 2011-12-02 13:52:12 -0500 (Fri, 02 Dec 2011) | 11 lines ticket: 7034 subject: mk_cred: memory management target_version: 1.10 tags: pullup Fix for mk_cred.c: calloc() not malloc() Avoid calling free() in cleanup on uninitialized sub-ptrs if error occurs. Signed-off-by: Kevin Wasserman ticket: 7034 version_fixed: 1.10 status: resolved git-svn-id: svn://anonsvn.mit.edu/krb5/branches/krb5-1-10@25519 dc483132-0cff-0310-8789-dd5450dbe970 --- diff --git a/src/lib/krb5/krb/mk_cred.c b/src/lib/krb5/krb/mk_cred.c index 4c95accd0..566d13816 100644 --- a/src/lib/krb5/krb/mk_cred.c +++ b/src/lib/krb5/krb/mk_cred.c @@ -97,7 +97,7 @@ krb5_mk_ncred_basic(krb5_context context, * structure and copy the ticket into the ticket list. */ for (i = 0; i < nppcreds; i++) { - credenc.ticket_info[i] = malloc(sizeof(krb5_cred_info)); + credenc.ticket_info[i] = calloc(1, sizeof(krb5_cred_info)); if (credenc.ticket_info[i] == NULL) { retval = ENOMEM; goto cleanup;