Make mit_des_finish_key() safe to call even if there is no key that
authorTheodore Tso <tytso@mit.edu>
Wed, 1 Nov 1995 03:07:54 +0000 (03:07 +0000)
committerTheodore Tso <tytso@mit.edu>
Wed, 1 Nov 1995 03:07:54 +0000 (03:07 +0000)
needs to be freed.

git-svn-id: svn://anonsvn.mit.edu/krb5/trunk@7009 dc483132-0cff-0310-8789-dd5450dbe970

src/lib/crypto/des/ChangeLog
src/lib/crypto/des/finish_key.c

index 524ffc173be6de6ab0b82f0f3e3ab95ae376dddc..d823b4136747501865ee95747da476c9cb9c2381 100644 (file)
@@ -1,3 +1,9 @@
+Tue Oct 31 22:06:52 1995  Theodore Y. Ts'o  <tytso@dcl>
+
+       * finish_key.c (mit_des_finish_key): Make mit_des_finish_key()
+               safe to call even if there is no key that needs to be
+               freed.
+
 Fri Oct  6 21:59:55 1995  Theodore Y. Ts'o  <tytso@dcl>
 
        * Makefile.in: Remove ##DOS!include of config/windows.in.
index f9e3d3d7ac7da1f3483759541c709d74dc20c12a..e7e9e13ae3341c51cc165fa953fc829fc3f9f2e3 100644 (file)
@@ -37,8 +37,10 @@ krb5_error_code
 mit_des_finish_key (eblock)
     krb5_encrypt_block FAR * eblock;
 {
-    memset((char *)eblock->priv, 0, (size_t) eblock->priv_size);
-    free(eblock->priv);
+    if (eblock->priv) {
+       memset((char *)eblock->priv, 0, (size_t) eblock->priv_size);
+       free(eblock->priv);
+    }
     eblock->priv = 0;
     eblock->priv_size = 0;
     /* free/clear other stuff here? */