From: Greg Hudson Date: Fri, 30 Jan 2009 21:25:40 +0000 (+0000) Subject: krb5_get_server_rcache had some dead (and incorrect) code for cleaning X-Git-Tag: krb5-1.7-alpha1~13 X-Git-Url: http://git.tremily.us/?a=commitdiff_plain;h=77b1e1108ca32617fe43825748c68c575e77f010;p=krb5.git krb5_get_server_rcache had some dead (and incorrect) code for cleaning up the rcache on failure. Fix the cleanup code and make use of it. git-svn-id: svn://anonsvn.mit.edu/krb5/trunk@21842 dc483132-0cff-0310-8789-dd5450dbe970 --- diff --git a/src/lib/krb5/krb/srv_rcache.c b/src/lib/krb5/krb/srv_rcache.c index 9da6d45ff..7d6b68a7e 100644 --- a/src/lib/krb5/krb/srv_rcache.c +++ b/src/lib/krb5/krb/srv_rcache.c @@ -71,21 +71,13 @@ krb5_get_server_rcache(krb5_context context, const krb5_data *piece, return ENOMEM; retval = krb5_rc_resolve_full(context, &rcache, cachename); - if (retval) { - rcache = 0; + if (retval) goto cleanup; - } - /* - * First try to recover the replay cache; if that doesn't work, - * initialize it. - */ - retval = krb5_rc_recover_or_initialize(context, rcache, context->clockskew); - if (retval) { - krb5_rc_close(context, rcache); - rcache = 0; + retval = krb5_rc_recover_or_initialize(context, rcache, + context->clockskew); + if (retval) goto cleanup; - } *rcptr = rcache; rcache = 0; @@ -93,7 +85,7 @@ krb5_get_server_rcache(krb5_context context, const krb5_data *piece, cleanup: if (rcache) - free(rcache); + krb5_rc_close(context, rcache); if (cachename) free(cachename); return retval;