In _kadm5_init_any on error - if we created a cache entry, destroy it
authorEzra Peisach <epeisach@mit.edu>
Sun, 22 Nov 2009 04:54:47 +0000 (04:54 +0000)
committerEzra Peisach <epeisach@mit.edu>
Sun, 22 Nov 2009 04:54:47 +0000 (04:54 +0000)
(parallel to kadm5_destroy code). Also - free config_params.

git-svn-id: svn://anonsvn.mit.edu/krb5/trunk@23300 dc483132-0cff-0310-8789-dd5450dbe970

src/lib/kadm5/clnt/client_init.c

index 82e417159e01a1677aea11d04b0ecec9776aaec3..95c4954ef336f901ec2ce412099e7bdba79b52af 100644 (file)
@@ -174,6 +174,7 @@ static kadm5_ret_t _kadm5_init_any(krb5_context context, char *client_name,
     int iprop_enable = 0;
     char full_svcname[BUFSIZ];
     char *realm;
+    krb5_ccache ccache;
 
     kadm5_server_handle_t handle;
     kadm5_config_params params_local;
@@ -390,6 +391,11 @@ error:
      * error" before the block of code at the top of the function
      * that allocates and initializes "handle".
      */
+    if (handle->destroy_cache && handle->cache_name) {
+        if (krb5_cc_resolve(handle->context,
+                            handle->cache_name, &ccache) == 0)
+            (void) krb5_cc_destroy (handle->context, ccache);
+    }
     if (handle->cache_name)
         free(handle->cache_name);
     if(handle->clnt && handle->clnt->cl_auth)
@@ -397,6 +403,8 @@ error:
     if(handle->clnt)
         clnt_destroy(handle->clnt);
 
+    kadm5_free_config_params(handle->context, &handle->params);
+
 cleanup:
     if (code)
         free(handle);