From: Theodore Tso Date: Fri, 23 Sep 1994 02:42:51 +0000 (+0000) Subject: Fix memory leak in klist --- the returned credentials should be freed before X-Git-Tag: krb5-1.0-beta4.3~92 X-Git-Url: http://git.tremily.us/?a=commitdiff_plain;h=20a1e94f417eb8c0ad75667fc37feb919ff8042b;p=krb5.git 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 --- 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");