提交 c1a8a5de 编写于 作者: N Nils Larsch

don't let BN_CTX_free(NULL) segfault

上级 e3d0e0a7
...@@ -230,7 +230,10 @@ BN_CTX *BN_CTX_new(void) ...@@ -230,7 +230,10 @@ BN_CTX *BN_CTX_new(void)
void BN_CTX_free(BN_CTX *ctx) void BN_CTX_free(BN_CTX *ctx)
{ {
if (ctx == NULL)
return;
#ifdef BN_CTX_DEBUG #ifdef BN_CTX_DEBUG
{
BN_POOL_ITEM *pool = ctx->pool.head; BN_POOL_ITEM *pool = ctx->pool.head;
fprintf(stderr,"BN_CTX_free, stack-size=%d, pool-bignums=%d\n", fprintf(stderr,"BN_CTX_free, stack-size=%d, pool-bignums=%d\n",
ctx->stack.size, ctx->pool.size); ctx->stack.size, ctx->pool.size);
...@@ -242,6 +245,7 @@ void BN_CTX_free(BN_CTX *ctx) ...@@ -242,6 +245,7 @@ void BN_CTX_free(BN_CTX *ctx)
pool = pool->next; pool = pool->next;
} }
fprintf(stderr,"\n"); fprintf(stderr,"\n");
}
#endif #endif
BN_STACK_finish(&ctx->stack); BN_STACK_finish(&ctx->stack);
BN_POOL_finish(&ctx->pool); BN_POOL_finish(&ctx->pool);
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册