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
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;
cleanup:
if (rcache)
- free(rcache);
+ krb5_rc_close(context, rcache);
if (cachename)
free(cachename);
return retval;