From: Mark Eichin Date: Wed, 6 Sep 1995 04:24:13 +0000 (+0000) Subject: * krb524d.c (main): set timeout inside while loop to prevent spin. X-Git-Tag: krb5-1.0-beta6~1165 X-Git-Url: http://git.tremily.us/?a=commitdiff_plain;h=5d9a10753d934f09c97b482554a05cc878d8e11a;p=krb5.git * 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. (emailed to bjaspan@cam.ov.com seperately.) git-svn-id: svn://anonsvn.mit.edu/krb5/trunk@6692 dc483132-0cff-0310-8789-dd5450dbe970 --- diff --git a/src/krb524/ChangeLog b/src/krb524/ChangeLog index 8b006ff45..0b4ed0cec 100644 --- a/src/krb524/ChangeLog +++ b/src/krb524/ChangeLog @@ -1,3 +1,10 @@ +Wed Sep 6 00:11:53 1995 Mark Eichin + + * 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) diff --git a/src/krb524/krb524d.c b/src/krb524/krb524d.c index 0e73f2087..fe128809f 100644 --- a/src/krb524/krb524d.c +++ b/src/krb524/krb524d.c @@ -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;