From: Theodore Tso Date: Wed, 1 Nov 1995 03:07:54 +0000 (+0000) Subject: Make mit_des_finish_key() safe to call even if there is no key that X-Git-Tag: krb5-1.0-beta6~863 X-Git-Url: http://git.tremily.us/?a=commitdiff_plain;h=a94eba01951fee60833ef2d42f3e224ba23cc2dc;p=krb5.git Make mit_des_finish_key() safe to call even if there is no key that needs to be freed. git-svn-id: svn://anonsvn.mit.edu/krb5/trunk@7009 dc483132-0cff-0310-8789-dd5450dbe970 --- diff --git a/src/lib/crypto/des/ChangeLog b/src/lib/crypto/des/ChangeLog index 524ffc173..d823b4136 100644 --- a/src/lib/crypto/des/ChangeLog +++ b/src/lib/crypto/des/ChangeLog @@ -1,3 +1,9 @@ +Tue Oct 31 22:06:52 1995 Theodore Y. Ts'o + + * 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 * Makefile.in: Remove ##DOS!include of config/windows.in. diff --git a/src/lib/crypto/des/finish_key.c b/src/lib/crypto/des/finish_key.c index f9e3d3d7a..e7e9e13ae 100644 --- a/src/lib/crypto/des/finish_key.c +++ b/src/lib/crypto/des/finish_key.c @@ -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? */