* krb524d.c (main): set timeout inside while loop to prevent spin.
authorMark Eichin <eichin@mit.edu>
Wed, 6 Sep 1995 04:24:13 +0000 (04:24 +0000)
committerMark Eichin <eichin@mit.edu>
Wed, 6 Sep 1995 04:24:13 +0000 (04:24 +0000)
(cleanup_and_exit): free master_princ or close keytab, and free
the global context, to eliminate spurious storage use in malloc
debugging.
(init_master): free realm.

(emailed to bjaspan@cam.ov.com seperately.)

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

src/krb524/ChangeLog
src/krb524/krb524d.c

index 8b006ff4570be71c44ee5ecf2f154ba8d4092b93..0b4ed0cec540b3de758ba914f9a3df6113da1444 100644 (file)
@@ -1,3 +1,10 @@
+Wed Sep  6 00:11:53 1995  Mark Eichin  <eichin@cygnus.com>
+
+       * krb524d.c (main): set timeout inside while loop to prevent spin.
+       (cleanup_and_exit): free master_princ or close keytab, and free
+       the global context, to eliminate spurious storage use in malloc
+       debugging.
+       (init_master): free realm.
 
 Tue Sep 05 22:10:34 1995   Chris Provenzano (proven@mit.edu)
 
index 0e73f20876bb042ffd013b0298912b4893cf8e41..fe128809ffbc03446d64e5084ebbf433d473b5bf 100644 (file)
@@ -138,11 +138,11 @@ int main(argc, argv)
          cleanup_and_exit(1, context);
      }
      
-     timeout.tv_sec = TIMEOUT;
-     timeout.tv_usec = 0;
      while (1) {
          FD_ZERO(&rfds);
          FD_SET(s, &rfds);
+         timeout.tv_sec = TIMEOUT;
+         timeout.tv_usec = 0;
 
          ret = select(s+1, &rfds, NULL, NULL, &timeout);
          if (signalled)
@@ -180,6 +180,9 @@ void cleanup_and_exit(ret, context)
          memset((char *)&master_encblock, 0, sizeof(master_encblock));
          (void) krb5_db_fini(context);
      }
+     if (use_master) krb5_free_principal(context, master_princ);
+     if (use_keytab) krb5_kt_close(context, kt);
+     krb5_free_context(context);
      exit(ret);
 }
 
@@ -213,8 +216,11 @@ void init_master(context)
      }
      if ((ret = krb5_db_setup_mkey_name(context, NULL, realm, (char **) 0,
                                       &master_princ))) {
+          free(realm);
          com_err(whoami, ret, "while setting up master key name");
          cleanup_and_exit(1, context);
+     } else {
+          free(realm);
      }
 
      master_keyblock.keytype = KEYTYPE_DES_CBC_MD5;