bus/dpaa: fix resource leak
authorHemant Agrawal <hemant.agrawal@nxp.com>
Mon, 9 Apr 2018 10:22:48 +0000 (15:52 +0530)
committerThomas Monjalon <thomas@monjalon.net>
Wed, 11 Apr 2018 22:20:47 +0000 (00:20 +0200)
Coverity issue: 268337
Fixes: 1459585888b5 ("bus/dpaa: fix memory allocation during scan")
Cc: stable@dpdk.org
Signed-off-by: Hemant Agrawal <hemant.agrawal@nxp.com>
Acked-by: Shreyansh Jain <shreyansh.jain@nxp.com>
drivers/bus/dpaa/base/fman/fman.c

index e6fd5f3..be91da4 100644 (file)
@@ -442,6 +442,7 @@ fman_if_init(const struct device_node *dpa_node)
                if (!pool_node) {
                        FMAN_ERR(-ENXIO, "%s: bad fsl,bman-buffer-pools\n",
                                 dname);
+                       free(bpool);
                        goto err;
                }
                pname = pool_node->full_name;
@@ -449,6 +450,7 @@ fman_if_init(const struct device_node *dpa_node)
                prop = of_get_property(pool_node, "fsl,bpid", &proplen);
                if (!prop) {
                        FMAN_ERR(-EINVAL, "%s: no fsl,bpid\n", pname);
+                       free(bpool);
                        goto err;
                }
                assert(proplen == sizeof(*prop));