From: Wenkai Lin <linwenkai6@hisilicon.com> The h_qp may be null, check null pointer before use it. Signed-off-by: Wenkai Lin <linwenkai6@hisilicon.com> Signed-off-by: Zongyu Wu <wuzongyu1@huawei.com> --- drv/hisi_dae_common.c | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/drv/hisi_dae_common.c b/drv/hisi_dae_common.c index 43b53e0..5cfc105 100644 --- a/drv/hisi_dae_common.c +++ b/drv/hisi_dae_common.c @@ -357,8 +357,10 @@ free_h_qp: out: for (j = 0; j < i; j++) { h_qp = (handle_t)wd_ctx_get_priv(config->ctxs[j].ctx); - dae_uninit_qp_priv(h_qp); - hisi_qm_free_qp(h_qp); + if (h_qp) { + dae_uninit_qp_priv(h_qp); + hisi_qm_free_qp(h_qp); + } } free(priv); return ret; @@ -378,8 +380,10 @@ void dae_exit(struct wd_alg_driver *drv) config = &priv->config; for (i = 0; i < config->ctx_num; i++) { h_qp = (handle_t)wd_ctx_get_priv(config->ctxs[i].ctx); - dae_uninit_qp_priv(h_qp); - hisi_qm_free_qp(h_qp); + if (h_qp) { + dae_uninit_qp_priv(h_qp); + hisi_qm_free_qp(h_qp); + } } free(priv); -- 2.33.0