Fix memory leak in klist --- the returned credentials should be freed before
authorTheodore Tso <tytso@mit.edu>
Fri, 23 Sep 1994 02:42:51 +0000 (02:42 +0000)
committerTheodore Tso <tytso@mit.edu>
Fri, 23 Sep 1994 02:42:51 +0000 (02:42 +0000)
the next set is fetched.

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

src/clients/klist/ChangeLog [new file with mode: 0644]
src/clients/klist/Makefile.in
src/clients/klist/klist.c

diff --git a/src/clients/klist/ChangeLog b/src/clients/klist/ChangeLog
new file mode 100644 (file)
index 0000000..bbdd39d
--- /dev/null
@@ -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.
+
index 0a7ba68881f177a8b511d8ddc439194198adfebf..f6567fedef908bfd9b3e531f8a95fc0d94bd1828 100644 (file)
@@ -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
index a5ab8a66aa2b1cc60d38315f5b526e3fa4ed046c..188c406a02f7568f4af5124db9aa6c6b812b7a92 100644 (file)
@@ -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");