From: Neng Xue Date: Wed, 7 May 2014 21:11:14 +0000 (-0700) Subject: Fix unlikely memory error in krb5_rd_cred X-Git-Tag: krb5-1.13-alpha1~148 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=60234f7b4cef58b66e0b2776988dfcf79c0d8bbb;p=thirdparty%2Fkrb5.git Fix unlikely memory error in krb5_rd_cred If an error occurs in the for loop in krb5_rd_cred_basic (which should only happen on an ENOMEM), do not leave the caller with a dangling reference to the freed credential array. ticket: 7908 (new) target_version: 1.12.2 --- diff --git a/src/lib/krb5/krb/rd_cred.c b/src/lib/krb5/krb/rd_cred.c index 8be7f81d6f..acc05c99bc 100644 --- a/src/lib/krb5/krb/rd_cred.c +++ b/src/lib/krb5/krb/rd_cred.c @@ -170,8 +170,10 @@ krb5_rd_cred_basic(krb5_context context, krb5_data *pcreddata, (*pppcreds)[i] = NULL; cleanup: - if (retval) + if (retval) { krb5_free_tgt_creds(context, *pppcreds); + *pppcreds = NULL; + } cleanup_cred: krb5_free_cred(context, pcred);