diff options
| author | Theodore Tso <tytso@mit.edu> | 1995-05-03 02:31:31 +0000 |
|---|---|---|
| committer | Theodore Tso <tytso@mit.edu> | 1995-05-03 02:31:31 +0000 |
| commit | 571ce1ba410bab8f96c073ceb7e7870e72c1b136 (patch) | |
| tree | 303cf29259b76fa5d78886f4aac796deb15821ef /src/lib | |
| parent | a0ea2067dd6c8b3b88a90d1949efca4297ad1408 (diff) | |
| download | krb5-571ce1ba410bab8f96c073ceb7e7870e72c1b136.tar.gz krb5-571ce1ba410bab8f96c073ceb7e7870e72c1b136.tar.xz krb5-571ce1ba410bab8f96c073ceb7e7870e72c1b136.zip | |
Fix memory leaks in this function. The krb5_donot_replay structure
was not being freed properly.
git-svn-id: svn://anonsvn.mit.edu/krb5/trunk@5694 dc483132-0cff-0310-8789-dd5450dbe970
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); |
