From: Tom Yu Date: Fri, 13 Jun 2003 21:45:30 +0000 (+0000) Subject: krb5_rd_rep leaks subkeys X-Git-Tag: krb5-1.4-beta1~848 X-Git-Url: http://git.tremily.us/?a=commitdiff_plain;h=fe1a9f94914b6a4c9c56e4f0770e210183530e3f;p=krb5.git krb5_rd_rep leaks subkeys * rd_rep.c (krb5_rd_rep): Free subkeys before replacing them, if needed. This avoids a memory leak. ticket: new target_version: 1.3 component: krb5-libs tags: pullup git-svn-id: svn://anonsvn.mit.edu/krb5/trunk@15620 dc483132-0cff-0310-8789-dd5450dbe970 --- diff --git a/src/lib/krb5/krb/ChangeLog b/src/lib/krb5/krb/ChangeLog index 3b5287f0c..b7aab3c0d 100644 --- a/src/lib/krb5/krb/ChangeLog +++ b/src/lib/krb5/krb/ChangeLog @@ -1,3 +1,8 @@ +2003-06-13 Tom Yu + + * rd_rep.c (krb5_rd_rep): Free subkeys before replacing them, if + needed. This avoids a memory leak. + 2003-06-11 Tom Yu * srv_rcache.c (krb5_get_server_rcache): Octal escapes begin with diff --git a/src/lib/krb5/krb/rd_rep.c b/src/lib/krb5/krb/rd_rep.c index 50ce51331..80192294e 100644 --- a/src/lib/krb5/krb/rd_rep.c +++ b/src/lib/krb5/krb/rd_rep.c @@ -81,10 +81,18 @@ krb5_rd_rep(krb5_context context, krb5_auth_context auth_context, const krb5_dat /* Set auth subkey */ if ((*repl)->subkey) { + if (auth_context->recv_subkey) { + krb5_free_keyblock(context, auth_context->recv_subkey); + auth_context->recv_subkey = NULL; + } retval = krb5_copy_keyblock(context, (*repl)->subkey, &auth_context->recv_subkey); if (retval) goto clean_scratch; + if (auth_context->send_subkey) { + krb5_free_keyblock(context, auth_context->send_subkey); + auth_context->send_subkey = NULL; + } retval = krb5_copy_keyblock(context, (*repl)->subkey, &auth_context->send_subkey); if (retval) {