projects
/
oweals
/
openssl.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
| inline |
side by side
(parent:
8716dbe
)
Only OPENSSL_free() non-NULL pointers.
author
Geoff Thorpe
<geoff@openssl.org>
Sat, 1 Sep 2001 18:37:17 +0000
(18:37 +0000)
committer
Geoff Thorpe
<geoff@openssl.org>
Sat, 1 Sep 2001 18:37:17 +0000
(18:37 +0000)
crypto/evp/digest.c
patch
|
blob
|
history
diff --git
a/crypto/evp/digest.c
b/crypto/evp/digest.c
index 5c5b118486319601bcdb42e61184e3396f7753ff..1457a001185d8f6910d9f82ea2fed36cef39730f 100644
(file)
--- a/
crypto/evp/digest.c
+++ b/
crypto/evp/digest.c
@@
-84,7
+84,8
@@
int EVP_DigestInit(EVP_MD_CTX *ctx, const EVP_MD *type)
{
if(ctx->digest != type)
{
- OPENSSL_free(ctx->md_data);
+ if(ctx->md_data != NULL)
+ OPENSSL_free(ctx->md_data);
ctx->digest=type;
#ifdef CRYPTO_MDEBUG
ctx->md_data=CRYPTO_malloc(type->ctx_size,file,line);
@@
-155,9
+156,10
@@
int EVP_MD_CTX_cleanup(EVP_MD_CTX *ctx)
* because sometimes only copies of the context are ever finalised.
*/
if(ctx->md_data)
- memset(ctx->md_data,0,ctx->digest->ctx_size);
-
- OPENSSL_free(ctx->md_data);
+ {
+ memset(ctx->md_data,0,ctx->digest->ctx_size);
+ OPENSSL_free(ctx->md_data);
+ }
memset(ctx,'\0',sizeof *ctx);
return 1;