mempool/dpaa: fix leak in pool creation failure
authorLi Qiang <liq3ea@163.com>
Tue, 9 Apr 2019 14:56:21 +0000 (07:56 -0700)
committerThomas Monjalon <thomas@monjalon.net>
Thu, 4 Jul 2019 15:20:33 +0000 (17:20 +0200)
When 'rte_zmalloc' failed dpaa_mbuf_create_pool() forgets freeing
'bp' thus leading resource leak. This patch avoids this.

Coverity issue: 337679

Signed-off-by: Li Qiang <liq3ea@163.com>
Acked-by: Hemant Agrawal <hemant.agrawal@nxp.com>
drivers/mempool/dpaa/dpaa_mempool.c

index 0030817..54cdf37 100644 (file)
@@ -78,8 +78,10 @@ dpaa_mbuf_create_pool(struct rte_mempool *mp)
                rte_dpaa_bpid_info = (struct dpaa_bp_info *)rte_zmalloc(NULL,
                                sizeof(struct dpaa_bp_info) * DPAA_MAX_BPOOLS,
                                RTE_CACHE_LINE_SIZE);
-               if (rte_dpaa_bpid_info == NULL)
+               if (rte_dpaa_bpid_info == NULL) {
+                       bman_free_pool(bp);
                        return -ENOMEM;
+               }
        }
 
        rte_dpaa_bpid_info[bpid].mp = mp;