From: Theodore Tso Date: Wed, 5 Oct 1994 02:11:23 +0000 (+0000) Subject: Only try to free the contents of the keytab_entry if it is non-NULL X-Git-Tag: krb5-1.0-beta4.3~3 X-Git-Url: http://git.tremily.us/?a=commitdiff_plain;h=545c66c05f389fab6aaebe7f4dcc1fa6335f2185;p=krb5.git Only try to free the contents of the keytab_entry if it is non-NULL git-svn-id: svn://anonsvn.mit.edu/krb5/trunk@4456 dc483132-0cff-0310-8789-dd5450dbe970 --- diff --git a/src/lib/krb5/keytab/ChangeLog b/src/lib/krb5/keytab/ChangeLog index f12e82213..172ddc801 100644 --- a/src/lib/krb5/keytab/ChangeLog +++ b/src/lib/krb5/keytab/ChangeLog @@ -1,3 +1,9 @@ +Tue Oct 4 22:06:15 1994 Theodore Y. Ts'o (tytso@dcl) + + * ktfr_entry.c (krb5_kt_free_entry): Only try to free + entry->key.contents if it is non-NULL. If entry is NULL, + return. + Thu Sep 29 23:19:06 1994 Theodore Y. Ts'o (tytso@dcl) * ktbase.c (krb5_kt_resolve_name): If the prefix "FILE:" is not diff --git a/src/lib/krb5/keytab/ktfr_entry.c b/src/lib/krb5/keytab/ktfr_entry.c index b30388f5f..9204033a7 100644 --- a/src/lib/krb5/keytab/ktfr_entry.c +++ b/src/lib/krb5/keytab/ktfr_entry.c @@ -32,8 +32,13 @@ krb5_error_code krb5_kt_free_entry (entry) krb5_keytab_entry *entry; { + if (!entry) + return 0; + krb5_free_principal(entry->principal); - memset((char *)entry->key.contents, 0, entry->key.length); - krb5_xfree(entry->key.contents); + if (entry->key.contents) { + memset((char *)entry->key.contents, 0, entry->key.length); + krb5_xfree(entry->key.contents); + } return 0; }