From 20a1e94f417eb8c0ad75667fc37feb919ff8042b Mon Sep 17 00:00:00 2001 From: Theodore Tso Date: Fri, 23 Sep 1994 02:42:51 +0000 Subject: [PATCH] Fix memory leak in klist --- the returned credentials should be freed before the next set is fetched. git-svn-id: svn://anonsvn.mit.edu/krb5/trunk@4339 dc483132-0cff-0310-8789-dd5450dbe970 --- src/clients/klist/ChangeLog | 5 +++++ src/clients/klist/Makefile.in | 6 +++--- src/clients/klist/klist.c | 4 +++- 3 files changed, 11 insertions(+), 4 deletions(-) create mode 100644 src/clients/klist/ChangeLog diff --git a/src/clients/klist/ChangeLog b/src/clients/klist/ChangeLog new file mode 100644 index 000000000..bbdd39d82 --- /dev/null +++ b/src/clients/klist/ChangeLog @@ -0,0 +1,5 @@ +Thu Sep 22 22:41:42 1994 Theodore Y. Ts'o (tytso@dcl) + + * klist.c (main): Fix memory leak in klist --- the returned + credentials should be freed before you fetch the next set. + diff --git a/src/clients/klist/Makefile.in b/src/clients/klist/Makefile.in index 0a7ba6888..f6567fede 100644 --- a/src/clients/klist/Makefile.in +++ b/src/clients/klist/Makefile.in @@ -3,13 +3,13 @@ LDFLAGS = -g ISODELIB=@ISODELIB@ COMERRLIB=$(BUILDTOP)/util/et/libcom_err.a -DBMLIB= all:: -KLIB = $(TOPLIBD)/libkrb5.a $(TOPLIBD)/libcrypto.a $(ISODELIB) $(COMERRLIB) $(DBMLIB) +KLIB = $(TOPLIBD)/libkrb5.a $(TOPLIBD)/libcrypto.a $(ISODELIB) $(COMERRLIB) +DEPKLIB = $(TOPLIBD)/libkrb5.a $(TOPLIBD)/libcrypto.a $(ISODELIB) $(COMERRLIB) -klist: klist.o +klist: klist.o $(DEPKLIB) $(CC) $(CFLAGS) -o klist klist.o $(KLIB) klist.o: $(srcdir)/klist.c diff --git a/src/clients/klist/klist.c b/src/clients/klist/klist.c index a5ab8a66a..188c406a0 100644 --- a/src/clients/klist/klist.c +++ b/src/clients/klist/klist.c @@ -132,8 +132,10 @@ main(argc, argv) } fputs(" Valid starting Expires Service principal\n", stdout); - while (!(code = krb5_cc_next_cred(cache, &cur, &creds))) + while (!(code = krb5_cc_next_cred(cache, &cur, &creds))) { show_credential(&creds); + krb5_free_cred_contents(&creds); + } if (code == KRB5_CC_END) { if (code = krb5_cc_end_seq_get(cache, &cur)) { com_err(progname, code, "while finishing ticket retrieval"); -- 2.26.2