From: Barry Jaspan Date: Mon, 11 Nov 1996 22:06:43 +0000 (+0000) Subject: * kdb_cpw.c (cleanup_key_data): fix memory leak [krb5-kdc/163] X-Git-Tag: krb5-1.0-freeze1~53 X-Git-Url: http://git.tremily.us/?a=commitdiff_plain;h=fe39b636fa66daed644976da52a0eff5dd3cc057;p=krb5.git * kdb_cpw.c (cleanup_key_data): fix memory leak [krb5-kdc/163] (add_key_pwd): fix memory leak [krb5-kdc/164] git-svn-id: svn://anonsvn.mit.edu/krb5/trunk@9376 dc483132-0cff-0310-8789-dd5450dbe970 --- diff --git a/src/lib/kdb/ChangeLog b/src/lib/kdb/ChangeLog index d4131f0f4..cdd78eae8 100644 --- a/src/lib/kdb/ChangeLog +++ b/src/lib/kdb/ChangeLog @@ -1,3 +1,8 @@ +Mon Nov 11 17:03:16 1996 Barry Jaspan + + * kdb_cpw.c (cleanup_key_data): fix memory leak [krb5-kdc/163] + (add_key_pwd): fix memory leak [krb5-kdc/164] + Sat Nov 9 15:57:50 1996 Ezra Peisach * t_krb5.conf: Dummy krb5.conf file from the krb5 library. diff --git a/src/lib/kdb/kdb_cpw.c b/src/lib/kdb/kdb_cpw.c index 54316dde0..c378ac6f9 100644 --- a/src/lib/kdb/kdb_cpw.c +++ b/src/lib/kdb/kdb_cpw.c @@ -58,6 +58,7 @@ cleanup_key_data(context, count, data) } } } + free(data); } /* @@ -408,15 +409,22 @@ add_key_pwd(context, master_eblock, ks_tuple, ks_tuple_count, passwd, pwd.data = passwd; pwd.length = strlen(passwd); if (retval = krb5_string_to_key(context, &key_eblock, &key, &pwd, - &key_salt.data)) - return(retval); + &key_salt.data)) { + if (key_salt.data.data) + free(key_salt.data.data); + return(retval); + } if (retval = krb5_dbekd_encrypt_key_data(context, master_eblock, &key, (const krb5_keysalt *)&key_salt, kvno, &db_entry->key_data[db_entry->n_key_data-1])) { + if (key_salt.data.data) + free(key_salt.data.data); krb5_xfree(key.contents); return(retval); } + if (key_salt.data.data) + free(key_salt.data.data); krb5_xfree(key.contents); } return(retval);