summaryrefslogtreecommitdiffstats
path: root/src/clients
diff options
context:
space:
mode:
authorGreg Hudson <ghudson@mit.edu>2013-07-15 11:14:24 -0400
committerGreg Hudson <ghudson@mit.edu>2013-07-15 11:14:24 -0400
commit6e51f9cc3152c8e419fe7f459bcf521d60358434 (patch)
tree336b6786af44ed595db1b3f6f2f6b358626b90cf /src/clients
parent04444a2606e3db92e66d74e29bef9103452f2cee (diff)
downloadkrb5-6e51f9cc3152c8e419fe7f459bcf521d60358434.tar.gz
krb5-6e51f9cc3152c8e419fe7f459bcf521d60358434.tar.xz
krb5-6e51f9cc3152c8e419fe7f459bcf521d60358434.zip
Fix minor leaks in klist
When walking the cache, if we skip a cred because it's a config entry, make sure to free it. Also free the result of krb5_cc_get_principal. Based on a patch from Nalin Dahyabhai.
Diffstat (limited to 'src/clients')
-rw-r--r--src/clients/klist/klist.c7
1 files changed, 4 insertions, 3 deletions
diff --git a/src/clients/klist/klist.c b/src/clients/klist/klist.c
index 6c040673c1..745a460854 100644
--- a/src/clients/klist/klist.c
+++ b/src/clients/klist/klist.c
@@ -520,9 +520,9 @@ do_ccache(krb5_ccache cache)
return 1;
}
while (!(code = krb5_cc_next_cred(kcontext, cache, &cur, &creds))) {
- if (!show_config && krb5_is_config_principal(kcontext, creds.server))
- continue;
- if (status_only) {
+ if (!show_config && krb5_is_config_principal(kcontext, creds.server)) {
+ /* Do nothing with this entry. */
+ } else if (status_only) {
if (exit_status && creds.server->length == 2 &&
data_eq(creds.server->realm, princ->realm) &&
data_eq_string(creds.server->data[0], "krbtgt") &&
@@ -556,6 +556,7 @@ do_ccache(krb5_ccache cache)
com_err(progname, code, _("while retrieving a ticket"));
return 1;
}
+ krb5_free_principal(kcontext, princ);
}
char *