summaryrefslogtreecommitdiffstats
path: root/crypto/bn/bn_ctx.c
diff options
context:
space:
mode:
authorNils Larsch <nils@openssl.org>2005-04-29 21:20:31 +0000
committerNils Larsch <nils@openssl.org>2005-04-29 21:20:31 +0000
commitc1a8a5de13776c1a7b1bdbef574dd47948f77372 (patch)
treefc83da8b915387e7c5e4c0bbfb7c6a5f00b62156 /crypto/bn/bn_ctx.c
parente3d0e0a7923dae0de9d201d08f4d597ff7032643 (diff)
don't let BN_CTX_free(NULL) segfault
Diffstat (limited to 'crypto/bn/bn_ctx.c')
-rw-r--r--crypto/bn/bn_ctx.c4
1 files changed, 4 insertions, 0 deletions
diff --git a/crypto/bn/bn_ctx.c b/crypto/bn/bn_ctx.c
index 7010193033..b3452f1a91 100644
--- a/crypto/bn/bn_ctx.c
+++ b/crypto/bn/bn_ctx.c
@@ -230,7 +230,10 @@ BN_CTX *BN_CTX_new(void)
void BN_CTX_free(BN_CTX *ctx)
{
+ if (ctx == NULL)
+ return;
#ifdef BN_CTX_DEBUG
+ {
BN_POOL_ITEM *pool = ctx->pool.head;
fprintf(stderr,"BN_CTX_free, stack-size=%d, pool-bignums=%d\n",
ctx->stack.size, ctx->pool.size);
@@ -242,6 +245,7 @@ void BN_CTX_free(BN_CTX *ctx)
pool = pool->next;
}
fprintf(stderr,"\n");
+ }
#endif
BN_STACK_finish(&ctx->stack);
BN_POOL_finish(&ctx->pool);