Add null pointer check of 'eng_ctx->qlist'.
Signed-off-by: Zhiqi Song songzhiqi1@huawei.com --- src/v1/alg/pkey/hpre_wd.c | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-)
diff --git a/src/v1/alg/pkey/hpre_wd.c b/src/v1/alg/pkey/hpre_wd.c index 971f7b2..855d47c 100644 --- a/src/v1/alg/pkey/hpre_wd.c +++ b/src/v1/alg/pkey/hpre_wd.c @@ -157,10 +157,13 @@ void hpre_free_eng_ctx(hpre_engine_ctx_t *eng_ctx) }
if (eng_ctx->opdata.op_type != WCRYPTO_RSA_GENKEY) { - if (eng_ctx->opdata.in) - eng_ctx->rsa_setup.br.free(eng_ctx->qlist->kae_queue_mem_pool, eng_ctx->opdata.in); + if (eng_ctx->opdata.in) { + if (eng_ctx->qlist) + eng_ctx->rsa_setup.br.free(eng_ctx->qlist->kae_queue_mem_pool, eng_ctx->opdata.in); + } + if (eng_ctx->opdata.out) { - if (eng_ctx->qlist != NULL) + if (eng_ctx->qlist) eng_ctx->rsa_setup.br.free(eng_ctx->qlist->kae_queue_mem_pool, eng_ctx->opdata.out); } } else {