diff options
Diffstat (limited to 'src/lib')
| -rw-r--r-- | src/lib/krb5/rcache/ChangeLog | 6 | ||||
| -rw-r--r-- | src/lib/krb5/rcache/rc_dfl.c | 33 |
2 files changed, 20 insertions, 19 deletions
diff --git a/src/lib/krb5/rcache/ChangeLog b/src/lib/krb5/rcache/ChangeLog index b55c33e99..30e6ffa1e 100644 --- a/src/lib/krb5/rcache/ChangeLog +++ b/src/lib/krb5/rcache/ChangeLog @@ -1,3 +1,9 @@ +Mon May 1 23:10:26 1995 Theodore Y. Ts'o (tytso@dcl) + + * rc_dfl.c (krb5_rc_dfl_recover): Fix memory leaks in this + function. The krb5_donot_replay structure was not being + freed properly. + Thu Apr 13 15:49:16 1995 Keith Vetter (keithv@fusion.com) * *.[ch]: removed unneeded INTERFACE from non-api functions. diff --git a/src/lib/krb5/rcache/rc_dfl.c b/src/lib/krb5/rcache/rc_dfl.c index 120eaa515..32999245b 100644 --- a/src/lib/krb5/rcache/rc_dfl.c +++ b/src/lib/krb5/rcache/rc_dfl.c @@ -401,21 +401,20 @@ krb5_rcache id; goto io_fail; } + if (!(rep = (krb5_donot_replay *) malloc(sizeof(krb5_donot_replay)))) { + retval = KRB5_RC_MALLOC; + goto io_fail; + } + rep->client = NULL; + rep->server = NULL; + /* now read in each auth_replay and insert into table */ for (;;) { - rep = NULL; if (krb5_rc_io_mark(context, &t->d)) { retval = KRB5_RC_IO; goto io_fail; } - if (!(rep = (krb5_donot_replay *) malloc(sizeof(krb5_donot_replay)))) { - retval = KRB5_RC_MALLOC; - goto io_fail; - } - rep->client = NULL; - rep->server = NULL; - retval = krb5_rc_io_fetch (context, t, rep, (int) max_size); if (retval == KRB5_RC_IO_EOF) @@ -424,22 +423,18 @@ krb5_rcache id; goto io_fail; - if (alive(context, rep,t->lifespan) == CMP_EXPIRED) { - krb5_rc_free_entry(context, &rep); - continue; + if (alive(context, rep,t->lifespan) != CMP_EXPIRED) { + if (store(context, id, rep) == CMP_MALLOC) { + retval = KRB5_RC_MALLOC; goto io_fail; + } } - - if (store(context, id,rep) == CMP_MALLOC) {/* can't be a replay */ - retval = KRB5_RC_MALLOC; goto io_fail; - } /* - * store() copies the server & client fields to make sure - * they don't get stomped on by other callers, so we need to - * free them + * free fields allocated by rc_io_fetch */ FREE(rep->server); FREE(rep->client); - rep = NULL; + rep->server = 0; + rep->client = 0; } retval = 0; krb5_rc_io_unmark(context, &t->d); |
