From: taoqi 30043660 taoqi10@huawei.com
Whether the pointer is NULL is not checked after the memory is applied for.
Signed-off-by: taoqi 30043660 taoqi10@huawei.com --- v1/wd_dh.c | 4 ++++ 1 file changed, 4 insertions(+)
diff --git a/v1/wd_dh.c b/v1/wd_dh.c index 3be6250..d574c1d 100644 --- a/v1/wd_dh.c +++ b/v1/wd_dh.c @@ -185,6 +185,10 @@ void *wcrypto_create_dh_ctx(struct wd_queue *q, struct wcrypto_dh_ctx_setup *set goto free_ctx; } ctx->g.data = ctx->setup.br.alloc(ctx->setup.br.usr, ctx->key_size); + if (!ctx->g.data) { + WD_ERR("failed to alloc ctx->g.data memory!\n"); + goto free_ctx; + } ctx->g.bsize = ctx->key_size;
ret = wcrypto_init_dh_cookie(ctx);