Only try to free the contents of the keytab_entry if it is non-NULL
authorTheodore Tso <tytso@mit.edu>
Wed, 5 Oct 1994 02:11:23 +0000 (02:11 +0000)
committerTheodore Tso <tytso@mit.edu>
Wed, 5 Oct 1994 02:11:23 +0000 (02:11 +0000)
git-svn-id: svn://anonsvn.mit.edu/krb5/trunk@4456 dc483132-0cff-0310-8789-dd5450dbe970

src/lib/krb5/keytab/ChangeLog
src/lib/krb5/keytab/ktfr_entry.c

index f12e8221391932b33097d27d137ad758b784d9fb..172ddc80122917be25b7eb2e640fb65b0855149b 100644 (file)
@@ -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
index b30388f5f61b04f039fdc253f6603e042fcf0839..9204033a7f2d763e898123a9df0a4d6cc9326665 100644 (file)
@@ -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;
 }