pull up r18283 from trunk
authorTom Yu <tlyu@mit.edu>
Fri, 30 Jun 2006 04:46:36 +0000 (04:46 +0000)
committerTom Yu <tlyu@mit.edu>
Fri, 30 Jun 2006 04:46:36 +0000 (04:46 +0000)
 r18283@cathode-dark-space:  tlyu | 2006-06-29 23:57:20 -0400
 ticket: 3962
 tags: pullup

  * src/lib/krb5/krb/srv_rcache.c (krb5_get_server_rcache): Adapted
  patch from Shawn Emery to set rcache = 0 in case of
  krb5_rc_resolve_full failure because krb5_rc_resolve_full frees
  but doesn't null rcache.  Also restore free of rcache in cleanup
  code.  Continue to not null rcache in failure on
  krb5_rc_recover_or_initialize because krb5_rc_close doesn't free
  rcache.

ticket: 3962
version_fixed: 1.5

git-svn-id: svn://anonsvn.mit.edu/krb5/branches/krb5-1-5@18284 dc483132-0cff-0310-8789-dd5450dbe970

src/lib/krb5/krb/srv_rcache.c

index da51b70b7d5805e67f38f8269c484f38c3561826..dc36827574bf1ab0014b6cfd1cf6258bcd647261 100644 (file)
@@ -105,8 +105,10 @@ krb5_get_server_rcache(krb5_context context, const krb5_data *piece,
     cachename[p++] = '\0';
 
     retval = krb5_rc_resolve_full(context, &rcache, cachename);
-    if (retval)
+    if (retval) {
+       rcache = 0;
        goto cleanup;
+    }
 
     /*
      * First try to recover the replay cache; if that doesn't work,
@@ -119,9 +121,12 @@ krb5_get_server_rcache(krb5_context context, const krb5_data *piece,
     }
 
     *rcptr = rcache;
+    rcache = 0;
     retval = 0;
 
 cleanup:
+    if (rcache)
+       krb5_xfree(rcache);
     if (cachename)
        krb5_xfree(cachename);
     return retval;